How to schedule a disk check for the next reboot. As root or using sudo do the following:

Method 1: Use the forecfsck file method

touch /forcefsck
shutdown -r now

Note: This command seems to check all partitions when run

Method 2: Up the mount count above the fsck check limit

Use this to identify what mounted partition you want to check

df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/sda2              88G   81G  2.5G  98% /

On a LVM system the path to the device can be quite long

df -h
Filesystem            Size  Used Avail Use% Mounted on
                       36G  913M   34G   3% /

/dev/sda5             236M   19M  206M   9% /boot

Check the current “Maximum mount count” and “Mount Count” values

tune2fs -l /dev/sda2 | grep -E '(Max|Mount)'
Mount count:              11
Maximum mount count:      36

Then set the actual “Mount count” to something higher

tune2fs -C 100 /dev/sda2

Check it out

tune2fs -l /dev/sda2 | grep Mount
Mount count:              100

Then reboot and wait for the disk check to finish, remember the bigger the volume the longer it takes. Make a cup of $BEVERAGE.

Ever wondered how to identify what partition is mentioned in /etc/fstab with

UUID=a0584727-1c8b-48df-867b-9e3b5a453ff7 /               ext3    defaults,errors=remount-ro 0       1

Use tune2fs and you will find the answer

tune2fs -l /dev/sda2 | grep UUID
Filesystem UUID:          a0584727-1c8b-48df-867b-9e3b5a453ff7

Now how would you apply a new UUID to a partition
tune2fs -U `uuidgen` /dev/sda3

tune2fs -l /dev/sda3 | grep UU
Filesystem UUID: 293512d5-fbb9-4a0a-9d50-ce347a3e0091

So it’s easy then to reference that in /etc/fstab

UUID=293512d5-fbb9-4a0a-9d50-ce347a3e0091            /media/sda3  ...

What is a UUID? It’s a Universally Unique Identifier. Theoretically, the way it’s generated means that you wont get a duplicate anywhere. You see them used a lot where uniqueness is needed (check the Windows Registry).

It is a better system then using labels to identify partitions because a label can be easily duplicated.

If you are old school Redhat then you can use e2label and apply a label to the partition:

e2label /dev/sda3 MYDISK

Then in /etc/fstab you can refer to the volume thusly

LABEL=MYDISK     /media/sda3     ext3    defaults        0       2

Note: I had to reboot for the above LABEL= change to take affect. The MYDISK label needs to appear in /dev/disk/by-label/MYDISK for a mount operation to work.

It’s probably better to make the label to be the same as the mount point. For example

e2label /dev/sdb12 /u2

Then add that to /etc/fstab

LABEL=/u2              /u2           ext3       defaults ....

would be mounted at /u2 so you know exactly where the partiton is going.