Filesystems

Written on .

Random filesystem notes.

GPT

Init partition table on a drive:

parted /dev/sdX mklabel gpt

Create partition on entire disk:

parted /dev/sdX mkpart primary 0% 100%

See all block devices:

lsblk --fs

Backup GPT header:

sgdisk /dev/sdX --backup sdX.gpt-backup

Restore a GPT header:

sgdisk --load-backup=sdX.gpt-backup /dev/sdX

Btrfs

Resolve logical to file paths:

btrfs inspect-internal logical-resolve <logical> <path>

OverlayFS

Basic usage:

mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,workdir=/work /merged

In fstab:

overlay /merged overlay noauto,x-systemd.automount,lowerdir=/lower,upperdir=/upper,workdir=/work 0 0