Jump to content

Check swap fstab/blkid match


sunrat

Recommended Posts

You know how the swap UUID can get changed and mismatch fstab when you install a new OS in a multiboot setup? Here's a command to check if fstab swap entry is correct:

if [ $(grep swap /etc/fstab | awk '{print $1}') == $(blkid | grep swap| awk '{print $2}'|sed s/'"'//g) ]; then echo "All is good";else echo "Swap UUID is different to fstab";fi

I saved it to my Zim Desktop Wiki repository of handy tips and commands.

 

Funny story how I came to this - someone posted a command on Debian User Forums purporting to do the same thing. I had a quick look at the command and realised it was comparing 2 identical commands so couldn't possibly flag a mismatch. Of course I had to fix it. :)

duty_calls.png

  • Like 5
Link to comment
Share on other sites

Well it has never happened to me, but I am all in for insurance so have added it to my ArchWay Zim. An I very nearly understood the command which worries me a tad.

I am still a bit confused about some aspects of code writing

 

t2aqdts.jpg

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...