View All Existing Disk Partitions Using fdisk -l
Before you create a new partition, or modify an existing partition, you might want to view all available partition in the system.
Use fdisk -l to view all available partitions as shown below.
device info will present under /dev
ide ------------------ /dev/had
For Creating a Partition
[root@bsrtech sysusers]# fdisk /dev/sda
m – To get the help
p - To print the partition table
n - To create a Partition
d – To delete a Partition
w - To save the modification
q - To quit without save
n : for new partition
(if we want to create a new primary partition already existing primary partitions will be deleted.
so we will go for logical partitions)
l : logical
(we can't able to specify space in inodes )
(provide size of partition)
+200M(here our partition size is 200 mb)
w: to save partition and write to partition table
partx: is the command to update kernel with out reboot.
(partx -a /dev/sda)
To format a partition ( linux file system is ext4)
mkfs.ext4 /dev/<partition no>
ex: mkfs.ext4 /dev/sda5
df -Th : is the command to view mounted partitions along with mount points & free space
mounting is a process to create a logical way to enter a partition
mkdir /redhat (mount point for drive)
mount :is the command use to view mounted partitions & to create mounting.
syntax: mount <partition> <mount point>
ex: mount /dev/sda5 /redhat
umount : is the command to clear mounting way.
syntax: umount < mountpoint>
ex: umount /redhat
To mount a partiton permanently, we have to edit configuration file
# vi /etc/fstab
add a line at the end
<partition> <mountpoint> <filesystem> <permissions> <fsck>
fsck: filesystem consistency check
if fsck is 1 1 only root can access
if fsck is 1 2 any body can access
if fsck is 0 0 only system can access
/dev/sda5 /redhat ext4 defaults 1 2
| | | | |
| | | | |
partition mountpoint file system permissions fsck