Scanning Linux Filesystems

Manual Scans

If you don’t know the device name, use fdisk, df , or any other tool to find it.

Unmount the device:

sudo umount /dev/sdb1
Run fsck to repair the file system:

sudo fsck -p /dev/sdb1
The -p option tells fsck to automatically repair any problems that can be safely fixed without user intervention.

Once the file system is repaired, mount the partition:

sudo mount /dev/sdc1

Automatic Scans on Boot

If the ‘pass’ option in /etc/fstab is set to ‘2’ then the OS will scan the disk on reboot if the ‘Maximum mount count’ value is reached. However the default value for this is -1, so it never gets scanned unless this setting is changed.

You may want to set this to a low number so that it gets scanner frequently, or you may want to set it to a higher number. Depending on the amount of time a scan takes to complete, this should be considered.

To edit the ‘Maximum mount count’ , first view your mount count:

sudo tune2fs -l /dev/sbd1 | grep "mount count"

To set the value to 10 use:

sudo tune2fs -c 10 /dev/sdb1

Check results again by running

sudo tune2fs -l /dev/sbd1 | grep "mount count"


Leave a Reply

Your email address will not be published. Required fields are marked *