How To Create New Partition in Linux

Creating new partition in linux a very normal practice. In this article we will be going to explain simple steps to create a new partition in linux, format it and mount it at your required mount point.

Create New Partition

See Also:

  • How to Create New Partition using LVM in Linux
  • LVM- Linux Interview Questions
  • List All Partition

    lsblk command by default list all partition in a tree-like format. Run below command as follows:

    # lsblk
    

    The output is as follows:

    lsblk Output

    [Or]

    You can all use fdisk command to list all partition, use following command as follows:

    # fdsik -l
    

    The output is as follows:

    Display Device

    Create New Partition

    With the help of fdisk command we can create new partitions. Execute below command to create new partition.

    # fdsik /dev/sdb
    

    Type m and press Enter to see a list of the commands you can use to create partition.

    Partition Help

    Use the n command to create a new partition. You can create a logical or primary partition (l for logical or p for primary). A disk can only have four primary partitions.

    Create Partition

    Formatting a Partition

    Before using the partition, you need to format new partitions with a file system. You can do this with mkfs command.

    # mkfs.ext4 /dev/sdb1
    

    Format Partition

    Mount The Partition

    You have successfully formatted the filesystem. Now you can mount the partition and use it.
    Mount Temporary

    # mount /dev/sda1 /mnt
    

    Temporary Mount

    Mount Permanent
    You can mount the partition permanently adding entry in fstab file.

    # vim /etc/fstab
    

    Add below line at the end of file.

    /dev/sda1  /mnt    ext4    defaults  0 0 
    

    Permanent Mount

    Run following command to mount the drive at run time.

    # mount -a
    

    Mount

    Run below command to display new partition.

    Df Output

    Enjoy it!

    No Responses

    Leave a Reply

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

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.