Filesystems


Disks and File Systems

Steps:


HDD Disk terms


Physical HDD


Physical SSD


Physical SSD Terms


Physical SSD Terms


A few more SSD tidbits


What is a partition?

A logical division of a hard disk. The OS treats a partition as if it were a distinct physical device.


Why partition?


More reasons for partitioning (from tldp.org)


More reasons for partitioning (from tldp.org)


Disadvantages of partitioning


Partition Questions


MBR = An important partition

MBR is the Master Boot Record.Overview


MBR


Booting


MBR


MBR

MBR is configured with a ‘bootable’ partition. So the system will read the first 512 bytes of that partition to figure out what to do next. -> load the bootloader into memory (i.e. Grub, ntldr, bootmgr).

This second stage bootloader is stored on a file on disk


Bootloader


Bootloader


MBR problems


Partition Details


Primary vs Logical

One primary partition of a hard drive may be subpartitioned. These are logical partitions. This effectively allows us to skirt the historical four partition limitation.

The primary partition used to house the logical partitions is called an extended partition and it has its own file system type (0x05). Unlike primary partitions, logical partitions must be contiguous. Each logical partition contains a pointer to the next logical partition, which implies that the number of logical partitions is unlimited. However, linux imposes limits on the total number of any type of partition on a drive, so this effectively limits the number of logical partitions. This is at most 15 partitions total on an SCSI disk and 63 total on an IDE disk.


Linux Partitions


More about devices


Partition tools


Filesystem Types

Once we have partitioned the disk, then we choose the way it should be formatted. What type of data organization do we want on the disk?

Types to choose from:


Filesystems vs Partitions

The difference between a disk or partition and the filesystem it contains is important. A few programs (including, reasonably enough, programs that create filesystems) operate directly on the raw sectors of a disk or partition; if there is an existing file system there it will be destroyed or seriously corrupted. Most programs operate on a filesystem, and therefore won’t work on a partition that doesn’t contain one (or that contains one of the wrong type).(TLDP)


Creating

Before we can use a disk or a partition as a Filesystem, it needs to be formatted… What does this mean?


Steps for partitioning More Detailed

  1. Use cfdisk or another program to partition free space
  2. Run the mkfs command to set up the filesystem(i.e. mkfs.ext2 /dev/sdb5)
  3. Create a mount point (i.e. mkdir testmount)
  4. Run the mount command (i.e. mount /dev/sdb5 testmount)