I placed an entry in my fstab file to add a swap partition.

I used output of a bash command to get the UUID of vdb1 partition(I can't copy paste).

Like this:

UUID=$(blkid -o value -s UUID /dev/vdb1)  swap   swap  defaults 0 0 

I'm getting a parse error when I run 'mount -a'.

How can I do this correctly?

  • 3
    fstab is not a shell script. Why don't you just use /dev/vdb1 as the first field (or add the actual UUID of the device directly)?
    – Kusalananda
    Jun 21 '19 at 21:20

As Kusalananda comments, fstab cannot interpret embedded shell commands, resulting in your fstab causing this error.

With regards to your comment about cut/paste - I understand that typing in a uuid is daunting and likely error prone, but you could simply append the uuid to the end of your fstab by executing:

blkid -o value -s UUID >> /etc/fstab

... And then editing /etc/fstab in order to edit the 'junk' uuid line into a valid syntax.

I suggest this only as a way of compensating for the lack of a mouse/copy/paste facility.

If you don't fully understand what I am proposing here then do not do this! It will make your fstab syntax invalid, and prevent your system from booting until corrected.

  • 1
    never thought of appending, thanks. Jun 21 '19 at 22:10

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.