Ubuntu Linux create partition

Table of Contents

Ubuntu Linux create partition

Purpose of this document is to explain how to create partition after provisioning new disk to Linux System.

  1. Purpose of document
  2. Partition disk
    2.1. Display partition
    2.2. Create extended partition
    2.3. Create logical partition in extended partition
  3. Create file system
  4. Create folder and mount newly created partition
  5. Check free space
  6. Auto mount partition at boot time
  7. New partition validation
  8. End of Document

 Ubuntu Linux create partition

1.     Purpose of document

Purpose of this document is to explain how to create partition after provisioning new disk to Linux System.

Disks are name as /dev/sda for First, /dev/sdb for Second and so on…..

In this document new third disk is provisioned and in OS visible as “/dev/sdc”.

2.     Partition disk

2.1.    Display partition

#fdilsk –l => Display disk and partition

#fdisk /dev/sdc => p (To see partition)

#fdisk /dev/sdc => p (To see partition)

m => help

Create new partition => n

2.2.    Create extended partition

Only 4 primary partitions can be created, for more than 4 partition need to create extended partition. Extended partition is a logical partition which needs to be further partitioned to use it.

“n” => to create new partition

To created extended partition => press “e” (Utilize all the space). To utilize all space press enter in “First sector” and “Last sector” as show below.  

Extended partition created

2.3.    Create logical partition in extended partition

  • If you want to use all extended space in one logical partition, press enter on “First sector” and “Last sector”.
  • If you want multiple logical partition, press enter on “First sector”, and mention size as (ex: +100M/ +10G) in “Last sector”

Multiple logical partitions will be names as /dev/sdc5, /dev/sdc6, /dev/sdc7 and so on.

Once partitioning done. Write partition table to disk.

Note: If you quit without write partition table, it will not create partition.

To write partition table on disk press “w”

Show partition table after created.

3.     Create file system

Create file system type for newly created partition. There are several types of files systems in Linux, like ext2,ext3,ext4 etc. Shown hear “ext4” type.

#mkfs -t ext4 /dev/sdc5

4.     Create folder and mount newly created partition

To mount the newly created partition, need to create folder and mount.

#mkdir /d01

#mount /dev/sdc5 /d01

Check the mounted partitions status

#mount                                => To see mounted partitions

5.     Check free space

Check the free space and size of the newly created and mounted partition.

6.     Auto mount partition at boot time

Create entry of new created partition “/dev/sdc5” in “/etc/fstab” file to auto mount at next boot.

/dev/sdc5           /d01       ext4       defaults               1              1

Once entry done in /etc/fstab, unmount newly created partition.

#umount /d01

#mount

One un-mounted execute below command to see if newly created partition is mounting without any issue.

#mount –a => This will mount the filesystems mention in /etc/fstab. This is to ensure in next boot there is no issue while mount newly created partition.

Hear you go. Reboot the system to ensure new partition available after reboot.

#uptime

#mount

7.     New partition validation

Create file and folder on newly created partition for testing.

Remove created test files and folders.

All set new partition is available to use.

8.     End of Document

Facebook Comments

One thought to “Ubuntu Linux create partition”

  1. Mahesh Balkrishna Govilkar says:

    Very nice and informative content. Keep posting ..

Leave a Reply

Your email address will not be published. Required fields are marked *