Skip to content

Chapter 4: Disks and Filesystems

Utility programs

  • parted:
  • gparted: graphical version of parted
  • fdisk: This one is nice because it allows you to review the things before executing them.

Partition tables

A partition allows you to isolate memory areas in a disk. You are free to create your own disk partitioning and this information is stored in partition tables which themselves are stored in in a special memory area of the disk reserved for that.

There are two major partition tables schemes: MBR and GPT.

Filesystems

It is the last link between the kernel and user space for disks. The Filesystem is a form of database that allows to transform block devices into a sophisticated hierarchy of files and directories.

Here are some common filesystems

  • Extended family (ext4, ext3 ...)
  • Btrfs (B-Tree filesystem): This is a candidate to replace ext4
  • FAT: Primitive filesystem very common in removable flash media
  • XFS: High performance filesystem used in some linux distributions
  • HFS+: Apple standard used in most Macintosh systems.
  • ISO9660: Very common in CD and DVD

Mounting

This is the process by which the systems attaches the filesystem of a device to a logical path such that one can access the filesystem from there. For example, one you plug a removable flash media, you need to mount the filesystem to which the disk was configured into a mounting point where you will access the files from it.

Useful commands

# List all disk partitions
parted -l

# Create a ext4 filesystem on partition /dev/sdf2
mkfs -t ext4 /dev/sdf2

# Mount a filesystem. /home/extra is the mounting point
mount -t ext4 /dev/sdf2 /home/extra