Jump to content


Check swap fstab/blkid match


  • Please log in to reply
2 replies to this topic

#1 OFFLINE   sunrat

sunrat

    Thread Kahuna

  • Forum Moderators
  • 5,374 posts

Posted 19 September 2017 - 07:54 PM

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. :)
Posted Image
registered Linux user number 324659  || The importance of Reading The *Fine* Manual! :D
Posted ImagePosted ImagePosted ImagePosted ImageKXStudio
For the things we have to learn before we can do them, we learn by doing them.

#2 OFFLINE   abarbarian

abarbarian

    Thread Kahuna

  • Forum MVP
  • 5,396 posts

Posted 20 September 2017 - 04:55 AM

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

Posted Image
Install ARCH
You'll never need to install it again
"I did and I'm really happy"

Posted Image~~~~~~~~~~~~~Posted Image

#3 OFFLINE   V.T. Eric Layton

V.T. Eric Layton

    Nocturnal Slacker

  • Forum Admins
  • 21,255 posts

Posted 20 September 2017 - 01:23 PM

I still use the /dev/sd* nomenclature on my machines, so I don't have the UUID mixup issue.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users