Linux Basic and Advanced Disc Partitioning for CentOS / RHEL 7/6

View Disk Information

To view available free space of a disk
[]# hwbrowser &
To view the free space in a partition
[]# df –h
To view the total amount of used space in a partition / directory
[]# du –sh
To know the block size of a partition
[]# blockdev –getbsz <partition>


To assign label to a partition
[]# e2label <partition> <label name>
To view the existing labels
[]# e2label <partition>
To see a mounted partition with its label
[]# mount –l

Swap Partition

Create a new Partition
[]# fdisk <device>
Format the partition as swap
[]# mkswap <partition>
Turn on Swap
[]# swapon <partition>
Check the status of swap used
[]# swapon –s <partition>
Turn off swap
[]# swapoff <partition>

Mounting a Partition Permanently

To mount a partition Permanently
[]# vl /etc/fstab

Mounting Removable Devices

To mount cdrom drive
[]# mount /dev/cdrom mnt
To mount a pen drive
[]# mount /dev sda1 /mnt

What is Logical Volume Manager (LVM)?

  • LVM is a method of allocating hard drive space into logical volumes that can be easily resized.
  • With LVM, the hard drive or set of hard drives is allocated to one or more physical volumes.
  • The physical volumes are then combined into volumes groups.
  • Each volumes group is divided into logical volumes, which are formatted with a file system like ext3 and are then mounted.

Creating Partitions

Make Multiple Partitions
[]# fdisk <device>
Update the partition table
[]# partprobe <device>

Physical Volume

Create a physical volume from the previously created partitions
[]# pvcreate <partition1> <partition2> <partition3>
To see the physical volume details
[]# pvdisplay |less

Volume Group

Create a volume group
[]# vgcreate <volume group name> <physical volume 1> <physical volume 2>
To see the volume group details
[]# vgdisplay <volume group name>

Logical volume

Create logical volume
[]# lvcreate –L <size> <volume group name> -n <volume name>
Format the logical volume
[]# mkfs.ext3 < volume name>
Create a mount point
[]# mkdir <directory name>
Mounting a logical volume
[]# mount <volume name > <mount point>
Re-sizing a logical volume
[]# lvresize –L <+sizeM> <logical volume name>
To update the re-sized logical volume
[]# resize2fs <logical volume name>
Removing logical volume
[]# lvremove <logical volume name>
Extending the size of a volume group
[]#vgextend <volume group name ><physical volume name>

Congratulations now you have created and managed the basic and advanced partitioning.