paapereira.xyz

Filesystem check in your USB external hard drives

Typically, every number of mounts, your partitions are automatically checked (e2fsck) at boot time. This will check and repair your hard drives.

But, if you have external hard drives connected only when needed, this automatic checks aren’t performed.

I recommend you to check your hard drive after like 30 mounts. See what is the maximum mount count in your internal system hard drive and use that count as reference.

I will list a number of useful commands to gather information about your drives and to check and repair them.

If you have suggestions, please let me know.

Checking your partitions

Use the command tree to list all your partition and find out witch device you want to check.

1sudo apt-get install tree
1tree /dev/disk
1sudo ls -l /dev/disk/by-label

Maximum mount count

Use the maximum mount count in your internal system hard drive and use that count as reference to regullary check your external hard drives.

1sudo tune2fs -l /dev/sda5 | grep "Maximum mount count"

Check Filesystem

1sudo umount /dev/sda5
1sudo e2fsck -C0 -f -p -v /dev/sda5
1sudo badblocks -sv /dev/sdb1 >> badblocks.report
1cat badblocks.report

smartmontools

Use the command smartmontools to print all SMART information about the disk (if your disk have smart capabilities).

1sudo apt-get install smartmontools
1sudo smartctl -a /dev/sda

Please comment this post with more useful tips or send me an email.

#Linux #Ubuntu