Managing disk partitions in Ubuntu using fdisk

Let’s review the existing disks:

sudo fdisk -l | grep '/dev/sd'

We display the fdisk menu for further work, for example with the disk /dev/sda:

sudo fdisk /dev/sda

Help can be obtained by pressing the “m” key, exit without saving the changes with the “q” key.

Before mounting, you must create any empty directory:

sudo mkdir /mnt/disk

For example, I connected an external HDD drive for backup copies and mounted with the following command:

sudo mkdir /backup_flows
sudo mount -t auto /dev/sdb1 /backup_flows

You can unmount a disk with the command:

umount /dev/sdb1

The /etc/fstab file contains information about all the partitions mounted at boot:

sudo nano /etc/fstab

To learn the UUID of partitions, you can use the command:

sudo blkid

You can format the command with:

sudo mkfs.ext4 /dev/sdb1

The table of the file system can be seen by the command:

df -h

See also my articles:
Mount NTFS partitions on Linux
Linux Partitioning

Leave a comment

Leave a Reply