Disk Druid: The only tool used for partitioning management at the time of installation
Partitioning management utilities available after installation:
Total partitions allowed is 63. From the fifth, it will be extended partition.
A limitation of fdisk is that it will recognize only up to 16 partitions. But we can apply size in MG or even GB.
In “parted” tool we can specify size only in cylindrical units.
# fdisk -l : Displays the number of devices and partitions.
# fdisk /dev/sda : To create a new partition in sda
- n = new partition
- p = Primary partition
- Leave starting block as default
- To create a 5 MB partition, use the value +500M
- w = save the partition
The partition will be identified only after rebooting the system.
# partprobe : This is to inform kernal about the new partition without rebooting the system.
The command mkfs is used to format a disk
|RHL||ext3 (up to 4 TB)|
The feature “journaling” is supported by ext3
# mkfs.ext3 /dev/sda9 : Command to format sda9 with ext3 file system
# df -h : Free space in every mounted file system will be displayed
Once formatted the partition could be mounted using the command
# mkdir /temp
# mount /dev/sda9 /temp
This is only a temporary mounting. For a permanent setup it had to be done using fstab.
Each block can be a minimum of 1025 bytes or maximum of 8192 bytes.
If size of partition <= 530 M , block = 1025 bytes
If size of partition > 530 M , block = 4096 bytes
When we create a file, each file will take 1 block. If the size of the file is more than the block size, the next nearest block will also be used.
In ext format, internal fragmentation happens since if a file is less than the block size, the excess portion in the block will not be used.
But external fragmentation, that leaves empty blocks in between used blocks will be avoided in ext format.
Due to this choosing the correct block size is good to control internal fragmentation.
# mkfs.ext3 -b 1055 /dev/sda9 : Formatting sda9 with a block size of 1055 bytes.
Note: This will wipe off all the current data in that partition.
Inode : This is a unique number that identifies each file. The total number of inodes, ie the no of files that could be created is decided at the time of formatting the partition.
Inode 1 -- 10 is reserved. Thus the first files will have inode # 11. Each inode will also contain information about the file stored in it. This data is called metadata which will occupy 128 bytes. Thus each inode should have a minimum of 128 bytes.
# stat /etc/passwd : Command to display the statistics of a file.
# mkfs.ext3 -N 1000 /dev/sda9 : set the maximum number of inode to 1000
Group-1 and group-2, etc are nodes that contains information of a set of nodes.
# mkfs.ext3 -c : To check bad blocks before formatting.
# mkfs.ext3 -L data /dev/hda9 : Assign a label “data” to hda9 while formatting.
# e2label /dev/sda9 : displays the label of sda9
# e2label /dev/sda9 llc : Give a new label to sda9
# findfs LABEL=llc : Find the device that has the label llc.
mount /dev/sda9 /opt/ and the command mount LABEL=llc /opt/ does the same function.