Analysis of Linux Disk Management and file System Topic III

Source: Internet
Author: User

1. Preface

Immediately following my previous blog for Disk Management operations:

http://zhangfengzhe.blog.51cto.com/8855103/1430531

We have partitioned the disk with the following information:

[[email protected] ~]# fdisk -l /dev/sdbdisk /dev/sdb: 1073 mb,  1073741824 bytes255 heads, 63 sectors/track, 130 cylindersunits =  Cylinders of 16065 * 512 = 8225280 bytes   device boot       Start         End       Blocks   Id  System/dev/sdb1                1            7       56196   83  linux/dev/ sdb2               8           15       64260    83  linux/dev/sdb3              16           25       80325    83  Linux/dev/sdb4               26         130       843412+   5  extended/dev/sdb5               26          32        56196   82  linux swap / solaris/dev/ sdb6              33           39       56196    83  linux/dev/sdb7              40           46       56196   83   Linux/dev/sdb8               47          53        56196   83  linux

From the above information, we can see that we have 3 primary partitions, an extended partition, and 3 logical partitions on the/DEV/SDB drive. So next, we should do a high-level format for the partition, that is, to create a file system for the partition.


2. How do I create a file system?


Note the point:

First, after the partition is created, the file system should be created next to be mounted and used.

Second, the file system should not be created on a partition that is already mounted.

Thirdly, you should create a specified partition "extended partition should not be used" instead of the entire hard disk.


Actual combat:

A can be created using the MKFS command. The common option for-t specifies the file system type to create. Like Ext2,ext3.

"The biggest difference between ext2 vs ext3 is that ext3 is a log-based file system. 】

[Email protected] ~]# mkfs-t EXT2/DEV/SDB1

MKE2FS 1.39 (29-may-2006)

Filesystem label=

OS Type:linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

14056 inodes, 56196 blocks

2809 Blocks (5.00%) reserved for the Super user

First Data block=1

Maximum filesystem blocks=57671680

7 Block groups

8192 blocks per group, 8192 fragments per group

Inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961


Writing Inode Tables:done

Writing superblocks and filesystem accounting Information:done


This filesystem'll be automatically checked every mounts or

Whichever comes first. Use Tune2fs-c or-i to override.



Read the above information:

  • Filesystem label refers to the volume label, said the straightforward point, that is, to give/dev/sdb1 an alias, convenient memory and reference.

  • Block size Specifies the block sizes, which are 1024 bytes, or 1 K.

  • The number of inode and block, from the above can be seen from the approximate ratio of INODE/BLOCK=1/4, that is, each 4 blocks to specify an inode, that is, 4K blocks corresponding to an inode.

  • XXX reserved ... Indicates how much space is reserved for the administrator. This ratio can be adjusted in subsequent adjustments.

  • Block groups, blocks, inodes, superblock these concepts have been involved in my previous blog, here are just a few simple reviews:

On disk, there is a block groups, which is for the purpose of convenient Disk Management division of the logical structure. In block group there are Superblock "super block, need to back up, mainly group related information", inodes "inode table/bit map", blocks "data".


[Email protected] ~]# mkfs-t EXT3/DEV/SDB2

MKE2FS 1.39 (29-may-2006)

Filesystem label=

OS Type:linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

16128 inodes, 64260 blocks

3213 blocks (5.00%) reserved for the Super user

First Data block=1

Maximum filesystem blocks=66060288

8 block groups

8192 blocks per group, 8192 fragments per group

Inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345


Writing Inode Tables:done

Creating Journal (4096 blocks): Done

Writing superblocks and filesystem accounting Information:done


The red information above indicates that EXT3 is a journal file system.



B about MKFS.EXT2 Mkfs.ext3 etc.

[Email protected] ~]# ls-l/sbin/mkfs*-rwxr-xr-x 1 root root 7092 June 2007/sbin/mkfs-rwxr-xr-x 1 root root 18100 J  Un 2007/sbin/mkfs.cramfs-rwxr-xr-x 3 root root 47288 June 2007/sbin/mkfs.ext2-rwxr-xr-x 3 root root 47288 June 25 2007/sbin/mkfs.ext3-rwxr-xr-x 3 root root 29672 Jan 2007/sbin/mkfs.msdos-rwxr-xr-x 3 root root 29672 Jan 11 2007/ Sbin/mkfs.vfat

According to which mkfs the above analysis, in fact, there are:

Mkfs.ext2 equal mkfs-t ext2 ...

Mkfs.ext3 equal mkfs-t ext3 ...


[Email protected] ~]# MKFS.EXT2/DEV/SDB3

.....

[Email protected] ~]# MKFS.EXT3/DEV/SDB5

.....


C Linux provides special command MKE2FS for the Ext type file system, it supports many options, convenient and flexible!

Note that without mke3fs this command, the ext3 type of file system can be created for MKE2FS directly using the option-J.

[Email protected] ~]# MKE2FS/DEV/SDB6

[Email protected] ~]# mke2fs-j/DEV/SDB7

Common options:

-j

-L Specify Volume label

-B Specify block size

-I specify Inode/block ratio

-N directly specify the number of Inode

-M Specify reserve ratio

-e Specifies some additional options to be added later.

-F Force creation.


3. Summary

Mkfs

Mkfs.ext2

Mkfs.ext3

Mke2fs



This article is from the "I want to surpass myself" blog, please be sure to keep this source http://zhangfengzhe.blog.51cto.com/8855103/1431991

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.