1

I just made a small mistake and reformatted my swap partition. It's still formatted as a swap partition - I was fortunate not to touch anything more important. However, I notice that the uuid has changed. Therefore, it no longer matches the uuid in /etc/fstab.

This doesn't cause me any immediate problems, presumably because swap is semi-redundant with modern RAM. Still, I would like to fix the problem.

First, is there a command that lets me verify my hypothesis - that my swap hasn't been detected by fstab after the uuid change? I looked at

 findmnt 

on a separate computer to see whether swap normally gets displayed - it doesn't. So what command shows you which partition, if any, is being utilised as swap?

Second, I presume I can just manually edit the fstab and change the uuid it 'expects' to the new uuid. Is that the 'right' way to fix it? Perhaps there are tools for 'safe' editing of fstab entries (like for grub.cfg) which I should look at (even if, in my case, not much can go wrong editing manually).

  • 2
    Use swapon -s to see partitions used as swap (if any). findmnt -st swap will list the swap space as defined in /etc/fstab ... – don_crissti Sep 4 '15 at 22:27
1

In answer to your second question, there's no dedicated wrapper for the fstab file; just open it in a text editor.

1

Yes, you can manually edit fstab and mount it by it's partition mapping. You could also run blkid /dev/path/to/swap/partition and get the uuid from there.

Since you reformatted the partition, you should know which partition it was (dev/sda or /dev/xvdb, etc.). If not, you can run fdisk -l to see your swap partition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.