1.9 KiB
1.9 KiB
LPIC-1 104.2: Keeping filesystems healthy
Running out of inodes, checking ext4 with e2fsck, backup superblocks,
tune2fs, checking XFS, and space held by deleted files.
Before you start
The lab adds two empty spare disks: /dev/loop40 (100 MiB) and
/dev/loop41 (512 MiB). Write answers to the files in
/root/lab-answers/.
Tasks
- Make a 100 MiB ext4 filesystem with few inodes and 1 KiB blocks on
/dev/loop40(mkfs.ext4 -N 1000 -b 1024), mount it, and create empty files in a loop until it fails. Comparedf -handdf -i. (With the 4 KiB blocks Ubuntu picks, a filesystem this small has a single block group and no backup superblock for task 3.) - Unmount it and run
e2fsck, thene2fsck -f, and read the five passes. - Find the backup superblocks with
dumpe2fs, then rune2fsck -f -b BACKUP /dev/loop40with the first one. Expect it to report something "FIXED" and "FILE SYSTEM WAS MODIFIED" even on a healthy filesystem: it rewrites the main superblock from the backup. Write the block number of the first backup superblock to/root/lab-answers/3. - Change the filesystem's label to
scratchand its reserved percentage to 2 withtune2fs, and check both withtune2fs -l. - Make an XFS filesystem on
/dev/loop41, runxfs_repair -non it unmounted, then mount it and runxfs_info. - Delete a large file while
tail -fholds it open, and comparedfanddubefore and after stoppingtail. Check it yourself:dfgets the space back only whentailends.
Hints
for i in $(seq 2000); do touch /mnt/small/f$i || break; done;df -i.umount; plaine2fsckskips a clean filesystem,-fforces it.dumpe2fs /dev/loop40 | grep -i superblock.tune2fs -L,tune2fs -m,tune2fs -l | grep -Ei 'volume name|reserved block|block count'.mkfs.xfs,xfs_repair -n,xfs_info MOUNTPOINT.lsof +L1lists deleted files that are still open.