Got a new hard drive for file server, but don’t want to use all the space for only one partition. And you can’t use GParted because you’re using Ubuntu Server. We can use parted for that purpose, here is how to use it:

  1. I got a brand new 2TB hard drive, I want to make several partition from that. For now, I just want to make 1 partition with 25% of hard drive. Use lsblk to know location your new hard drive, then use parted /dev/sdb.

    lsblk To Know Your Hard Drive Mount Location

    lsblk To Know Your Hard Drive Mount Location

  2. After enter the parted command, use mklabel gpt to define gpt as our partition table format. Use mkpart primary ext4 0% 25% then use print to check your new partition. then type quit to exit parted command

  3. Use lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT again to check our partition.

    New Partition, Still in Raw Format

    New Partition, Still in Raw Format


    I don’t know why it’s still in raw format/unallocated because I already define it as ext4. Will update this post when I made a new partition, for now I will keep it just like this

  4. Use mkfs.ext4 /dev/sdb1 to format partition as ext4. Check again use lsblk, is it already got a fstype?

  5. To mount the drive automatically, you have to provide several info at /etc/fstab. Use blkid to check the UUID all partition. Make a new folder as a mount point your new partition, /newharddrive/partition1.

  6. Add new line at /etc/fstab, UUID=yourUUID /newharddrive/partition ext4 defaults 0 0. Use mount -a to automatically mount new partition. You can check mount partition using mount -v