Fstab – Why Swap Space Doesn’t Get Filesystem Check at Boot Time?

fsckfstabswap

As I was checking the /etc/fstab I noticed that the swap space has attr pass=0, which means its filesystem is not checked at boot time.
Can anyone please tell me why is this behavior for?

Best Answer

At boot time, swap doesn’t contain any data which would need to be recovered, so there’s no point in writing a tool to repair swap. If a swap partition or file is corrupted in such a way that swapon can’t make use of it, the fix is to mkswap it again — there’s no need for a separate fsck.swap tool, so there isn’t one and /etc/fstab isn’t set up to use one.

It might then seem nice for swapon to automatically mkswap if necessary, but that would mean that any mistake in the arguments to swapon would be instantly fatal to the data stored in the given volume or file.

Related Question