

We need to now format these partitions before we mount and use them. Running the lsblk command will show the newly created partitions. If everything looks as expected, you can exit the partitioning tool by typing ‘quit’: (parted) quit It will display the partitions you created. To see how the partitioning has worked, run the print command: (parted) print You can replace ‘ext4’ with desired file type: ntfs, vfat, btrfs… If you want to create one more partition for the remaining space, you know the end point and the start point: (parted) mkpart primary ext4 5GB 100% This command will create a second partition of 3GB. Next, we’ll create another partition, but because we already have one partition, the end point of previous partition is now the starting point of the next partition. Here it will create a partition with 2GB storage. But if I want to create more than one partition, I will run this command: (parted) mkpart primary ext4 1MiB 2GB Here 100% means it will use all the available space. If I want to use all the space and create one big partition I will run this command: (parted) mkpart primary ext4 1MiB 100% This is the basic format of the command: (parted) mkpart ‘type of partition’ ‘file system’ start end Here ‘mklabel’ creates the partition table and ‘msdos’ will use MBR. Comparison between the two is beyond the scope of this story. There is good old MBR (master boot record) and newer GPT (guid partition table). Now we have to create a new partition table. The tool is extremely powerful and choosing the wrong device may lead to valuable data loss, so please use caution while formatting your drives.Īfter entering the password, you will notice (parted) added, which means you are now inside the parted utility. sudo parted /dev/sdbĭoublecheck to make sure to add the block device you want to format otherwise, parted will run on ‘sda’ or the drive where your OS is installed and you may end up with a broken system. The procedure can be used on any storage device, external or internal. I will be formatting a 3.8GB USB flash drive.
#HARD DRIVE FORMATS EXTFS 2 FREE#
In this tutorial, I am using ‘parted’ as it’s easy to use and can handle both MBR and GPT partitioning tables, but feel free to use your favorite partitioning tool. There is no dearth of quality tools in the Linux world, and we tend to use the ones we like. Format a drive completely with a brand new partition table The lsblk command is capable of giving out more information about storage devices, but we are keeping our focus on formatting a device. The last column tells about the mount point. TYPE tells whether it’s a disk or partition, and you can see that block device name with numbers ‘sda1, sda2…’ are marked as partitions. RO tells whether the device is read only, such as a DVD drive or write protected Flash drive. Obviously, the SIZE column tells about usable storage space on the device. RM tells whether the device is removable, and in this example, you can see that the USB drive ‘sdb’ is a removable device.

MAJ:MIN denotes the major and minor device number. are the block device names and ‘sda1’, ‘sda2’… denote the partitions on each device. In the figure above, the NAME column gives out the name of the device (it’s not consistent and can change based on which device was mounted first). As you can see, the lsblk command is showing me my SSD ‘sda’ where Linux Mint 18.1 is installed, ‘sdb’ is a USB Flash Drive, and ‘sdc’ is 1TB internal hard drive. Using ‘lsblk’ is the simplest and easiest way to find all block devices connected to your system.
#HARD DRIVE FORMATS EXTFS 2 HOW TO#
How to find what is connected or plugged to your system I prefer to use the command line, as it’s much easier and fail safe. However, every once in a while I come across issues where it throws errors and fails to format a drive. If you happen to use Gnome, then the Disks tool is quite useful. There are many graphics tools to manage your hard drive. The article is aimed at beginners and new users of Linux. In this article, I will talk about some of the basics of storage devices on Linux. With a tiny mistake, you may lose data or wrongly format your drive in a way that can lead to data corruption. Managing storage devices - whether they are internal hard drives, SSDs, PCIe SSDs, or external USB devices - is always a tricky task.
