Professional Documents
Culture Documents
Exemple Création Filesystème
Exemple Création Filesystème
Exemple Création Filesystème
mkfs utility is used to create filesystem (ext2, ext3, ext4, etc) on your Linux system.
You should specify the device name to mkfs on which the filesystem to be created.
WARNING: Executing these commands will destroy all the data on your filesystem.
So, try these commands only on a test system where you don’t care about losing your
data.
# cd /sbin
# ls mkfs*
OS type: Linux
4096000
Please note that the default filesystem type for mkfs command is ext2. If you don’t
specify “-t” option, it will create ext2 filesystem.
Also, you can use the method we discussed earlier to identify whether you have ext2
or ext3 or ext4 file system.
# mke2fs /dev/sda6 -j
Filesystem label=
OS type: Linux
4096000
When you don’t need the journaling on a filesystem, then execute mke2fs command
as shown below.
# mke2fs /dev/sda6
# mke2fs -c /dev/sda6
Filesystem label=
OS type: Linux
4096000
# mke2fs -F /dev/sda6
As seen above, on /dev/sda6 the IUsed is 11 out of 1120112. After the new file gets
created on it, the value of IUsed gets changes accordingly as shown below.
# cd /mydata
# touch sample.txt
# ls
sample.txt
# df -i /dev/sda6
You may also use the tune2fs command to view the Inode details:
Filesystem label=
OS type: Linux
4096000
As seen above, the bytes-per-inode is changed to 8192 from the default value of
16384. Now the inode limit of the partition got increased as shown below.
# df -i /dev/sda6
Filesystem label=
OS type: Linux
4096000
Allocating group tables: done
As seen above, the size is being changed from 256 to 128 and it leads in increasing the
total Inode count on a partition:
Filesystem label=DATA
OS type: Linux
4096000
You can view the label name of the above partition by using e2label command as
shown below:
# e2label /dev/sda6
DATA
Another way to view the label of a partition is using blkid command as shown below:
# blkid /dev/sda6
Filesystem label=
OS type: Linux
4096000
Filesystem label=
OS type: Linux
4096000
The above can be verified using both tune2fs and df command as shown below.
First inode: 11
Journal inode: 8
# df -i /dev/sda6