$ sudo parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt (parted) unit TB (parted) mkpart Partition name? ? panda File system type? [ext2]? ext4 Start? 0 End? 1 (parted) print Model: ASMT 2115 (scsi) Disk /dev/sdb: 1.00TB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:
Number Start End Size File system Name Flags 1 0.00TB 1.00TB 1.00TB ext4 panda
(parted) quit Information: You may need to update /etc/fstab.
Once it is done, we could confirm the partitions of the disk using the following command.
1 2 3 4 5 6 7 8
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 465.3G 0 part / sdb 8:16 0 931.5G 0 disk └─sdb1 8:17 0 931.5G 0 part sr0 11:0 1 1024M 0 rom
We could see that the only partition for our new hard drive is sdb1.
Command Line Formatting
The next step is to format the partitions. This can be done easily using the following command. Make sure the device partition name is the desired one.
Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
Mount Hard Drive File System
So far we have prepared a new hard drive with partitions. However, its file system is not visible on our operating system because it has not been mounted. To mount the new hard drive file system, we have to create an empty directory for mounting first.
$ sudo mkdir /media/panda
To mount and unmount manually, we could run the following commands.