Disk Management – How to Add an Entry to fstab

diskfstab

I 've unmounted a disk /dev/vdc1 on my machine, after I format it into xfs file system, I didn't mount it again, either didn't add the adequate line to fstab file.

Now when i want to mount this partition, but I can't access to it: mount: can't find dev/vdc1 in /etc/fstab or /etc/mtab. So how should I put in fstab file so the system recognizes it again ? the partition was mounted on /Data

Best Answer

So here we create an fstab entry for the partition:

  1. You need to create the folder for the partition and get the device id.
    Open a terminal. The folder can be created via

    sudo mkdir /media/Data
    In addition I would make the user the owner and give him the right to read/write:
    sudo chown [user]:[group] /media/Data
    sudo chmod +rw /media/Data

  2. Now the fstab entry:

    • Install libblkid1 to see device specific information: sudo apt-get install libblkid1
    • Enter sudo blkid and look for the stick. The output could be:
      /dev/sda2: UUID="32a4b76f-246e-486e-8495-31b8a781fb4c" TYPE="swap" 
      /dev/sda1: UUID="31f39d50-16fa-4248-b396-0cba7cd6eff2" TYPE="ext4"
      
    • Then we create the fstab entry: sudo gedit /etc/fstab and append the line
      UUID=31f39d50-16fa-4248-b396-0cba7cd6eff2     /media/Data   auto    rw,user,auto    0    0
      (and afterwards give a empty new line to avoid warnings).

To mount the partition, open a terminal and type

mount /media/Data
Because of the entry auto it should be mounted automatically on next boot.

Related Question