Use fsck to check and repair a file system. The file system must be unmounted when being check and repaired to prevent corruption!

The root file system can not be unmounted and checked. Two possible options to check the system are:

  • Force the Root Filesystem to use fsck during reboot, The Geek Stuff covers this well in, How to Force Check Root Filesystem using fsck During Reboot. A summary of key commands:
  • The Root file system is automatically checked at certain intervals. To check this: sudo tune2fs -l /dev/sda1 | grep -i check.
  • To force a recheck at the next reboot, create the file forcefsck. At the next reboot a fsck will be performed and the forcefsck file removed. Commands:
    • cd /
    • sudo touch forcefsck
  • Boot the system to a rescue file system. From the rescue file system the main boot drive may then be checked with fsck. (Further details not given.)
  • To check current mounted disks use df -h
  • To check current disks use sudo fdisk -l. (This is a disk partition command. Be careful with use.)
  • To check current disks use sudo parted -l. (This is a disk partition command, more modern than fdisk. Be careful with use.)
  • To check directory size use sudo du --max-depth=1 --all -h
  • The filesystem boot file is /etc/fstab, sudo vim /etc/fstab. (Be careful with editing this.)
  • To check ext2/3/4 file system information and configuration of a partition sudo tune2fs -l /dev/sdX

Home Server Index

The ‘’lsblk’’ command has a lot of information returned. The ‘’tune2fs’’ command is used by the system administrator to change/modify tunable parameters on ext2, ext3 and ext4 type filesystems. The command to display filesystem information is ‘’tune2fs -l /dev/sda2’’. The ‘’df’’ command lists current mounted disks.

  • lsblk by itself give the basic drive partition and mount point information.
  • lsblk -o NAME,MODEL,SERIAL,WWN,HCTL,MOUNTPOINT gives more comprehensive information:
    • WWN is a unique identifier ode list on the drive
    • HCTL lists the drive sata port
  • lsblk –help to list all the options
  • /app/www/public/data/pages/home_server/home_server_setup/disk_check.txt
  • Last modified: 2023-04-30 Sun wk17 17:43
  • by