a Linux EXT3 filesystem. Similar to the previous two, if you customized
the options to 'mke2fs / mkfs', 'mke2fs -n' is not the answer since it
will only produce data about generic FS creation. Our host details this
time are:
HOST: tux PROMPT: tux [0] OS: CentOS 5.4 Linux DISK PARTITION: sdc1As previously, we start off with 'mke2fs' to create a generic ext3
filesystem on 'sdc1':
tux [0] /sbin/mke2fs -j /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 131072 inodes, 524284 blocks 26214 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67633152 64 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.The output from 'mke2fs -n' returns nearly identical output from the
'mke2fs' used to create the FS. As an aside, since we already know the
FS is ext3 rather than ext2, we've include '-j' to 'mke2fs' to address
the journal:
tux [0] /sbin/mke2fs -n -j /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 131072 inodes, 524284 blocks 26214 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67633152 64 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409Alright, let's muck with some of the parameters available to 'mke2fs'.
After '-v -j', we set the FS revision, number of inodes, block size,
number of bytes per inode (nbpi), journal size, percent of reserved
blocks, and a volume label:
tux [0] /sbin/mke2fs -v -j -r 1 -N 65536 -b 4096 -i 2048 -J size=16 -m 3 -L c1vol /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label=c1vol OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 65536 inodes, 131071 blocks 3932 blocks (3.00%) reserved for the super user First data block=0 Maximum filesystem blocks=134217728 4 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 36 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.Back to 'mke2fs -n' to compare the output:
tux [0] /sbin/mke2fs -nv /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 131072 inodes, 524284 blocks 26214 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67633152 64 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409Without knowing the original parameters to 'mke2fs', the output from 'mke2fs
-n' is effectively useless. Turning to 'dumpe2fs', we can get all of
the parameters necessary to recreate our FS:
tux [0] /sbin/dumpe2fs -h /dev/sdc1 dumpe2fs 1.39 (29-May-2006) Filesystem volume name: c1vol Last mounted on: <not available> Filesystem UUID: f4b38089-b48f-4741-a4c8-bec7e1bfdcc8 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal resize_inode dir_index filetype sparse_super large_file Default mount options: (none) Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 65536 Block count: 131071 Reserved block count: 3932 Free blocks: 124808 Free inodes: 65525 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 31 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 16384 Inode blocks per group: 512 Filesystem created: Sat Jan 15 15:29:38 2011 Last mount time: n/a Last write time: Sat Jan 15 15:29:39 2011 Mount count: 0 Maximum mount count: 36 Last checked: Sat Jan 15 15:29:38 2011 Check interval: 15552000 (6 months) Next check after: Thu Jul 14 16:29:38 2011 Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal inode: 8 Default directory hash: tea Directory Hash Seed: 0b0c0827-6864-4320-b643-cf3e113f05e6 Journal backup: inode blocks Journal size: 16MOf note, the output from 'dumpe2fs -h' is identical to 'tune2fs -l' with
the exception that 'dumpe2fs' includes the journal size. Moving along,
output from 'dumpe2fs -h' correlates to the following 'mke2fs' parameters:
** dumpe2fs ** ** mke2fs ** Filesystem volume name: -L volume_label Filesystem revision #: -r value Inode count: -N value Reserved block count: -m % (obtainable with equation 1) Block size: -b bytes Inode size: -i bytes (obtainable with equation 2) Journal size: -J size=MBEquation 1: To determine the percentage of reserved blocks, we can use
the following, rounding to the nearest hundredth:
% reserved blocks = (reserved block count / block count) = (3932 / 131071) = 0.029 % reserved blocks = 3%Equation 2: To determine the nbpi, we can use the following, rounding
to the nearest 1024 increment:
nbpi (-i) = (block count / inode size) = (131071 / 128) = 1023.99 nbpi (-i) = 1024So, to put it all together, we get:
tux [0] /sbin/mke2fs -nv -j -r 1 -N 65536 -b 4096 -i 1024 -J size=16 -m 3 -L c1vol /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label=c1vol OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 65536 inodes, 131071 blocks 3932 blocks (3.00%) reserved for the super user First data block=0 Maximum filesystem blocks=134217728 4 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304Without the '-n' option to 'mke2fs', the new filesystem would have
been created to the specs of the original. Of the reasons to use '-n'
with our other options, we can determine the appropriate location of
the backup superblocks.
Included for reference, the following details the correlation of 'tune2fs'
and 'mke2fs' parameters to the output of dumpe2fs:
tune2fs | mke2fs | dumpe2fs |
-L vollabe | -L vollabel | Filesystem volume name: |
-M dir | -M dir | Last mounted on: |
Filesystem UUID: | ||
Filesystem magic number: | ||
-r revision [0|(1)] | Filesystem revision #: | |
-O feat,.. | -O feature,...,... | Filesystem features: |
-o opt,... | Default mount options: | |
Filesystem state: | ||
-e val | Errors Behavior: | |
-o creator-os | Filesystem OS type: | |
-N val | Inode count: | |
Block count: | ||
-r coun | -m % | Reserved block count: |
Free blocks: | ||
Free inodes: | ||
First block: | ||
-b bytes | Block size: | |
-f bytes (ignored) | Fragment size: | |
Reserved GDT blocks: | ||
-g val | Blocks per group: | |
Fragments per group: | ||
Inodes per group: | ||
Inode blocks per group: | ||
Filesystem created: | ||
Last mount time: | ||
Last write time: | ||
-C val | Mount count: | |
-c val | Maximum mount count: | |
-T val | Last checked: | |
Next check after: | ||
-u uid | Reserved blocks uid: | |
-g gid | Reserved blocks gid: | |
First inode: | ||
-i bytes | Inode size: | |
Journal inode: | ||
Default directory hash: | ||
Directory Hash Seed: | ||
Journal backup: | ||
-j size=M | -J size=MB | Journal size: |
see also:
Recreate a Solaris UFS FS
Recreate a FreeBSD UFS FS