LFCS and LFCE: How do we list, create and modify physical storage partitions on Linux?


We are continuing our journey to prepare for the certifications LFCS and LFCE, this time we will focus on the Storage Systems. 

There are many options to visualize/list our physical storage partitions on Linux, here there is one option:

cat /proc/partitions #listing using /proc/partitions

To have the list of the partitions with more info, we can use this command: 

(keep in mind that you need a root user or use it as sudo)

fdisk /dev/sdb

If you have some space unused on your disk you could create a new partition. The two most popular tools to create partitions are fdisk or parted

  • unpartitioned disk space
  • use fdisk or parted (or other suitable tools)
  • set partition type

Formatting Partitions:

When we partition a disk we set up space but it doesn't have any structure. 

A formatting example can be: 

mkfs -t <type> <partition>
mkfs -t ext4 /dev/sda

Keep in mind that ordinary files can also be formatted and mounted. This operation it's basically associating a file system with a directory. 

mount /dev/sda1 /mySSD

In some cases, there are special File Systems: proc, debugfs, NFS, etc. are mounted with the mount command. Example:

mount -t proc proc /proc

Comments

Leave as a comment:

Archive