Complete Example — Raw Device to Usable Filesystem
Every tool in this section has been covered individually — partitioning, filesystems, mounting, LVM, measuring usage, cloning. This chapter is the payoff: one realistic scenario, start to finish, using the plain-partition approach from earlier in this section (rather than LVM, which already got its own dedicated walkthrough) to bring a brand new disk into full, permanent service.
The Scenario
A server has just had a second disk attached — plenty of free space, currently completely unused, not yet even partitioned. The goal: get it partitioned, formatted, mounted at /mnt/backups, and configured to mount automatically on every future boot.
Step 1: Confirm What You’re Working With
Before touching anything, per the habit established at the very start of this section:
lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part /
sdb 8:16 0 50G 0 disksdb is the new disk — 50G, no partitions, no MOUNTPOINTS entry at all, confirming it’s genuinely untouched. This is the confirmation step that matters most in the entire walkthrough: everything from here on assumes /dev/sdb specifically, and getting this wrong at the start means every subsequent command targets the wrong disk.
Step 2: Partition It
Using fdisk, per the recommendation from the Partitioning Tools chapter — its “nothing’s written until w” behavior is exactly the safety margin worth having while working through a real procedure like this:
sudo fdisk /dev/sdbInside the interactive session:
Command: n (create a new partition)
Partition type: p (primary)
Partition number: 1
First sector: (press Enter to accept the default)
Last sector: (press Enter to accept the default, using the whole disk)
Command: w (write the change and exit)Confirm it took effect:
lsblksdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 partStep 3: Create A Filesystem
Following the guidance from the Filesystems chapter — this is general-purpose storage with no specific need for xfs’s throughput characteristics or btrfs’s snapshot features, so ext4 is the right, unremarkable default:
sudo mkfs.ext4 -L backups /dev/sdb1The -L backups label, (from the mkfs chapter) gives this filesystem a memorable name independent of its device path — useful the moment more than one extra disk is attached to the same server.
Step 4: Create A Mount Point And Mount It
sudo mkdir -p /mnt/backups
sudo mount /dev/sdb1 /mnt/backupsVerify:
df -h /mnt/backupsFilesystem Size Used Avail Use% Mounted on
/dev/sdb1 49G 24K 47G 1% /mnt/backupsCorrectly mounted, essentially empty, exactly as expected for a filesystem that was just created.
Step 5: Make It Permanent
Everything up to this point disappears on reboot unless it’s registered in /etc/fstab, per the Mounting chapter. Get the filesystem’s UUID first:
sudo blkid /dev/sdb1/dev/sdb1: LABEL="backups" UUID="8f3e2a1b-9c4d-4e5f-a6b7-c8d9e0f1a2b3" TYPE="ext4"Add an entry:
sudo nano /etc/fstabUUID=8f3e2a1b-9c4d-4e5f-a6b7-c8d9e0f1a2b3 /mnt/backups ext4 defaults 0 2And — this is the step that’s easy to skip when you’re confident everything’s correct, and exactly the step the Mounting chapter insisted on for that reason — test it immediately, without rebooting:
sudo umount /mnt/backups
sudo mount -a
df -h /mnt/backupsUnmounting first and then letting mount -a remount it based purely on the /etc/fstab entry is a genuine end-to-end test — if there were a typo in the UUID, a wrong filesystem type, or any other mistake in that line, this is where it would surface, safely, while you’re still logged in and able to fix it immediately.
Step 6: Confirm It Survives A Reboot
The real test — reboot the system, then check again:
sudo rebootAfter it comes back up:
lsblk
df -h /mnt/backupsIf /mnt/backups shows up mounted correctly with no manual intervention, the disk is now genuinely, permanently in service.
What This Walkthrough Actually Demonstrated
Every step here pulled directly from an earlier chapters in this section: lsblk for confirmation, fdisk for partitioning, mkfs.ext4 for formatting, mount and /etc/fstab for making it stick, and df for verification along the way. Nothing in this chapter was a new command — the value here was in the sequencing and the habits around it: confirm before you act, test before you trust, and never skip the verification step just because you’re confident.