0

I was editing my fstab and somehow [spooky music] deleted it. As you can imagine this has caused some problems and I have searched online for the shape of the default file to no avail.

Can someone with a working setup just run cat /etc/fstab and post the results please? I understand I will have to change the UUIDs.

I'm on Raspberry Pi 3, running Raspbian following the standard tutorial.

Maybe someone could also include the pi-2 setup for completeness..

1

I have a Raspberry Pi 3.

cat /etc/fstab

proc            /proc           proc    defaults          0 0
PARTUUID=232c31bf-01  /boot           vfat    defaults 0       2
PARTUUID=232c31bf-02  /               ext4    defaults,noatime 0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
6
  • perfect thank you!
    – Wapiti
    Dec 23 '21 at 18:27
  • Note that the PARTUUID needs to be adjusted, unless the OP used exactly the same image as you did. Dec 23 '21 at 20:51
  • 1
    @DmitryGrigoryev Exactly. The OP acknowledged this when he said: "I understand I will have to change the UUIDs," in his post.
    – Sanders
    Dec 24 '21 at 18:58
  • @Sanders If I'm not mistaken, he added this line to his post after my comment. You kinda make it sound like I didn't read the question well enough. Dec 26 '21 at 0:10
  • 1
    No, I did not add that line after your post Dmitry. I knew I had to change the IDs. Sanders was right, I acknowledged it. And you didn't read the question well enough.
    – Wapiti
    Dec 27 '21 at 18:46
1

There is no "standard" - generally PARTUUID depends on the specific image installed. (It can also be changed - which I do routinely.)

I use the following code to verify images, as it often gets confused restoring from backups.

#! /bin/sh
# 2021-02-10

#   Check consistency of Disk identifier in cmdline.txt /etc/fstab

# Determine Disk identifier
DISKID=$(sudo fdisk -l /dev/mmcblk0 | awk '/Disk identifier/ {print $3};' | sed 's/0x//')

# Use sed to delete all BEFORE PARTUUID= and all AFTER -0  in /boot/cmdline.txt
ROOTPART=$(sed -e 's/^.*PARTUUID=//' -e 's/-0.*$'// /boot/cmdline.txt)
echo "Disk ID\t\t"$DISKID
echo "root PARTUUID\t"$ROOTPART

# find first PARTUUID ext4 in /etc/fstab
EXISTFSTABPART=$(awk '/PARTUUID.*ext4/ {print $1; exit};' /etc/fstab | sed -e 's/^.*PARTUUID=//' -e 's/-0.*$'//)

echo "Existing fstab\t"$EXISTFSTABPART

if [ $DISKID = $EXISTFSTABPART ]; then
    echo "Looks OK!"
# else
fi

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.