31HardDrive

After partitioning the disks, it is still not ready for usage, as we need to

format the disk. At this stage, if you try to view the disk information, it

will give the following error message indicating that no valid superblock

is present.

 

# tune2fs -l /dev/sda1

 

tune2fs 1.35 (12-May-2013)

tune2fs: Bad magic number in super-block while trying to

open /dev/sda1

 

Couldn’t find valid filesystem superblock.

To format the disk, use mke2fs as shown below.

 

# mke2fs /dev/sda1

You can also pass the following optional parameter to the mke2fs.

 

• -m 0 : reserved-blocks-percentage – This indicates the percentage of the filesystem blocks reserved for the root user.Default is 5%. In the following example, it is set to 0.

 

• -b 4096 : block-size specified in bytes. Valid values are 1024,

2048 and 4096 bytes per block.

 

 

# mke2fs -m 0 -b 4096 /dev/sda1

 

mke2fs 1.35 (14-May-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

205344 inodes, 70069497 blocks

0 blocks (0.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=71303168

2139 block groups

32768 blocks per group, 32768 fragments per group

96 inodes per group

Superblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736,

1605632, 2654208, 4096000, 7962624, 11239424, 20480000,23887872

 

Writing inode tables: done

Writing superblocks and filesystem accounting information:done

 

This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs –c or -i to override.

 

The above command will create an ext2 filesystem. To create an ext3 file

system do the following:

 

# mkfs.ext3 /dev/sda1

 

# mke2fs –j /dev/sda1