Filesystem Setup
mkfs / mount / fstab commands for writable Forest OS installs. Copy-pasteable.
See Choosing a Filesystem for which filesystem to pick: FAT is writable (fat.c, Production), ext2 is read-only (ext2.c). Rule: want persistence → FAT root.
Replace /dev/sdX1, /dev/sdX2, /dev/sda1 with your real partition (check with blkid first). All mkfs commands erase the target.
1. Format Partitions with mkfs
FAT32 root (writable install)
mkfs -t fat32 -L ROOT /dev/sda1
FAT32 ESP (UEFI boot partition)
mkfs -t fat32 -L ESP /dev/sda1
FAT32 data partition (separate /home or /data)
mkfs -t fat32 -L FOREST-DATA /dev/sda2
ext2 root (read-only system image)
mkfs -t ext2 /dev/sda1
Verify the format and label after each mkfs:
blkid /dev/sda1
blkid /dev/sda2
Expected output shows type and label, e.g. LABEL="ROOT" TYPE="vfat" or LABEL="ESP" TYPE="vfat" / TYPE="ext2".
Check / repair before first mount:
fsck /dev/sda1
fsck /dev/sda2
2. Mount
Create mount points and mount by hand:
mkdir -p /mnt/root /mnt/data
mount -t vfat /dev/sda1 /mnt/root
mount -t vfat /dev/sda2 /mnt/data
Mount an ext2 image (read-only driver — writes will fail):
mkdir -p /mnt/ext2
mount -t ext2 /dev/sda1 /mnt/ext2
Mount everything listed in /etc/fstab at once (after editing fstab):
mount -a
Bind-mount (mirror one directory tree at a second path, e.g. for installer chroots):
mkdir -p /mnt/root/home
mount --bind /mnt/data /mnt/root/home
Mount an ISO / disk image via loop (no USB burn needed):
mkdir -p /mnt/iso
mount -o loop /root/forest-live.iso /mnt/iso
Confirm mounts and space usage:
df -h
du -sh /mnt/root /mnt/data
blkid
3. fstab Variants
Edit /etc/fstab on the installed root. One line per filesystem: <device> <mountpoint> <type> <options> <dump> <pass>. After editing, run mount -a to apply, then df -h to confirm.
Variant A — FAT root (recommended writable install)
Root + tmpfs + procfs/sysfs. Everything persists because the root driver is writable.
/dev/sda1 / vfat defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
proc /proc procfs defaults 0 0
sys /sys sysfs defaults 0 0
mount -a
df -h
Variant B — ext2 root + FAT /home (sealed system, writable home)
System files live on a read-only ext2 root; user data lives on a writable FAT partition. Edits under / cannot be saved — save work under /home.
/dev/sda1 / ext2 ro 0 0
/dev/sda2 /home vfat defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
proc /proc procfs defaults 0 0
sys /sys sysfs defaults 0 0
mount -a
df -h
touch /home/test-write && echo "home writable: OK" && rm /home/test-write
Copy-to-writable workflow for files on the read-only root:
cp /README.txt /home/
Variant C — Persistent USB (live system + writable data)
Live boot media stays untouched; a labeled FOREST-DATA partition holds changes, configs, and packages across reboots.
/dev/sda1 / vfat ro 0 0
/dev/sda2 /data vfat defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
proc /proc procfs defaults 0 0
sys /sys sysfs defaults 0 0
With a bind-mount so /home lands on the persistent partition:
/dev/sda1 / vfat ro 0 0
/dev/sda2 /data vfat defaults 0 0
/data/home /home none bind 0 0
tmpfs /tmp tmpfs defaults 0 0
proc /proc procfs defaults 0 0
sys /sys sysfs defaults 0 0
mkdir -p /data /data/home /home
mount -a
df -h
touch /data/test-write && echo "persistence writable: OK" && rm /data/test-write
4. Verify: blkid / fsck / df / du
Run after mkfs, after editing fstab, and after mount -a:
blkid
fsck /dev/sda1
fsck /dev/sda2
df -h
du -sh / /home /data /tmp
| Command | Checks |
|---|---|
blkid | Partition exists, type (vfat/ext2), label (ROOT/ESP/FOREST-DATA) matches your fstab device |
fsck /dev/sda1 | Filesystem clean before mounting (run while unmounted) |
df -h | Every fstab entry actually mounted, free space sane |
du -sh / /home /data | Data lands where you expect (root vs /home vs /data) |
5. Read-Only Mount Test and Remount rw
Test that a mount is truly read-only, then remount it writable (FAT only — ext2 stays read-only under the kernel driver):
mkdir -p /mnt/test
mount -r -t vfat /dev/sda1 /mnt/test
touch /mnt/test/should-fail && echo "UNEXPECTED: wrote to read-only mount" || echo "OK: read-only mount blocks writes"
Remount the same mount point read-write without unmounting:
mount -o remount,rw /mnt/test
touch /mnt/test/write-ok && echo "OK: remount rw works" && rm /mnt/test/write-ok
Same test directly on the live root or data mount:
mount -r -o remount /data
touch /data/should-fail && echo "UNEXPECTED: wrote to read-only mount" || echo "OK: /data is read-only"
mount -o remount,rw /data
touch /data/write-ok && echo "OK: /data writable again" && rm /data/write-ok
ext2 note: mount -o remount,rw on an ext2 mount will not make it writable — ext2.c is read-only. If the write test keeps failing on ext2, that is expected; keep a FAT /home or /data (Variant B/C) for anything you need to save.
See Also
- Choosing a Filesystem — which type to format
- Partitioning — start sector 63, type bytes
- Disk Tools —
mkfs/mount/blkid/fsckreference - Filesystems — driver read/write status