/etc/fstab + Mounting Drive = Error

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
Post Reply
ea234
Level 1
Level 1
Posts: 4
Joined: Sun Mar 11, 2018 5:55 am
Location: Germany, Hamburg

/etc/fstab + Mounting Drive = Error

Post by ea234 » Sat Apr 14, 2018 4:28 am

Hello,

I added a new Harddrive to my system. The last thing to do was to
add that drive to the file "/etc/fstab".

I read some articles about the "/etc/fstab". At last I added the following line:

/dev/sdb /media/ea234/HD4TBB ext3 default 0 0

... which went bad. Linux wouldn't boot up.
I managed to get rid of my false line, so Linux is now up and running.

But what did I do wrong?

Here is my list of outputs that could help to answer my question

ea234@MsiZ370 ~ $ blkid
/dev/sda1: UUID="86EA-CBBB" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="c4a73750-2901-408d-815c-10edc16d6e8b"
/dev/sda2: UUID="bc9fd6f2-a7ce-4c6e-95f0-f98108a5b5fd" TYPE="ext4" PARTUUID="a174ea19-35e5-439f-9b91-43a0ba5a738e"
/dev/sda3: UUID="19ce67a1-680d-4cc7-9d09-2747773dd282" TYPE="swap" PARTUUID="5f95fc02-e2a6-464a-b68d-61f03eb114e2"
/dev/sdb: LABEL="HD4TBB" UUID="d00e8652-5707-4cf0-b2b6-71fdf569d93d" SEC_TYPE="ext2" TYPE="ext3"
ea234@MsiZ370 ~ $ mount
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdd1 on /media/ea234/DATEN2018A type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
/dev/sdc1 on /media/ea234/BKUP2017 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
/dev/sdb on /media/ea234/HD4TBB type ext3 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

Here is my existing /etc/fstab-File:

# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
UUID=bc9fd6f2-a7ce-4c6e-95f0-f98108a5b5fd / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=86EA-CBBB /boot/efi vfat umask=0077 0 1
# swap was on /dev/sda3 during installation
UUID=19ce67a1-680d-4cc7-9d09-2747773dd282 none swap sw 0 0



And here are the instructions to edit the "/etc/fstab"-file in recovery mode:

1. Once Linux is failing on boot you have to options "control-D" wich continues the linux-boot,
or you can press enter to the linux command line.

2. After you pressed enter, do the following

change to the root-directory
change to the etc directory
start the vi editor with fstab

ea234@MsiZ370 ~ $ cd /
ea234@MsiZ370 / $ cd etc
ea234@MsiZ370 /etc $ vi fstab


3. VI-Editor
You have to type ":<command>"
to edit a line
:i = insert characters to the line (ESC ends this mode)
:x = save (that is ":" + "X"


----
So here are my Questions:
1. What is the right line to place into my fstab-file
2. Is there a Linux-Prg which can also place mounting-points into the fstab-file?
3. ... is there a descent editor for the comand line?

Eckbert

User avatar
slipstick
Level 5
Level 5
Posts: 943
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: /etc/fstab + Mounting Drive = Error

Post by slipstick » Sat Apr 14, 2018 5:19 am

Answering in reverse order:
3. Nano is much easier to use than vi.

Code: Select all

sudo nano /etc/fstab
Make your changes, then Ctrl-o to save the changes and Ctrl-x to exit nano. Or even easier, use your file manager to open the /etc directory as "Root", click on fstab to open the file with Xed and edit and save it.

1 and 2. Nothing special about a mount point - it's just an empty directory, which you can make either by the terminal command "mkdir" from the directory where you want to add it, or from a graphical file manager. After adding the mount point, edit fstab to make a new line including the path of the mountpoint. For example, I have a partition for my data which I have mounted at /home/steve/Data. I just made the folder Data in my /home directory, using Nemo, then added these lines to my fstab (first line is a just a comment):

Code: Select all

# automount Data partition at boot
UUID=be736ee9-0a66-4b77-8943-75801d3c3fbd /home/steve/Data ext4 defaults,noatime 0 3
In theory, theory and practice are the same. In practice, they ain't.

fabien85
Level 7
Level 7
Posts: 1584
Joined: Tue Mar 11, 2014 4:30 pm

Re: /etc/fstab + Mounting Drive = Error

Post by fabien85 » Sat Apr 14, 2018 5:42 am

One thing that could have gone wrong is the option, it's "defaults" not "default".
Also it's best practice to identify a device with it's UUID. /dev/sdb may refer to another drive, eg if you plug several drives at boot, you dont know in which order they will be recognised
Finally if you place an entry in the fstab, and the drive is not present at boot, then you will get an error. There is a way around that but I cant remember it at the moment.

1. I would try

Code: Select all

UUID=d00e8652-5707-4cf0-b2b6-71fdf569d93d  /media/ea234/HD4TBB  ext3  defaults  0  0
2. Gnome-disks does this job. It's called simply Disks in the Cinnamon menu
3. Yes there are. You will get different recommendations depending on people. There are unconditionnals of vi/vim. I prefer emacs, and lately for quick tasks I most often use nano (ctrl+o to save, ctrl+x to exit). If you just want to read the file without editing it, just use cat for small files, less for page by page reading of long files, and tail for reading just the end.

Edit: slipstick got faster than me. Also he is right, you have to create the mount point beforehand. You can take the occasion to mount the drive at a more practical location.

User avatar
Flemur
Level 17
Level 17
Posts: 7388
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: /etc/fstab + Mounting Drive = Error

Post by Flemur » Sat Apr 14, 2018 10:57 am

ea234 wrote:
Sat Apr 14, 2018 4:28 am
I read some articles about the "/etc/fstab". At last I added the following line:
/dev/sdb /media/ea234/HD4TBB ext3 default 0 0
sdb = the entire drive; sdb1, sdb2, etc would be the partitions. You don't mount the drive.

- make a backup copy of /etc/fstab first.

- Use your regular text editor, like this:

Code: Select all

gksudo gedit /etc/fstab
unless you're familiar with 'vi' or 'nano' (I use vi all the time, from Unix, but nano seems pointless. It *is* pointless if you have a GUI).
Use 'gksudo', not 'sudo'.

- with the partitions unmounted, use gparted to give them a LABEL, which is much nicer than either "/dev/sdb1" or "UUID=some junk".

Then, with a label of "DATA", your fstab file line would look something like:

Code: Select all

LABEL=DATA  /mnt/DATA  ext4 defaults,noatime 0 0
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: /etc/fstab + Mounting Drive = Error

Post by Mute Ant » Sat Apr 14, 2018 6:34 pm

"There is a way around that but I cant remember it at the moment..." That would be the 'noerror' 'nofail' option. EDIT TY smurphos.

I mount whole drives like that. Sometimes it's a newbie error based on C: drive D: drive confusion... this time I think it's exactly correct...
/dev/sdb: LABEL="HD4TBB" UUID="d00e8652-5707-4cf0-b2b6-71fdf569d93d" SEC_TYPE="ext2" TYPE="ext3"
...looks mountable...

Code: Select all

### file:///etc/fstab
#
#### What           Where   Type   Options               Dump   Check
     LABEL=HD4TBB   /root   ext3   defaults,nofail       0      2
#
###eof###
Last edited by Mute Ant on Sun Apr 15, 2018 11:21 am, edited 1 time in total.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

jaymot
Level 2
Level 2
Posts: 81
Joined: Thu Apr 12, 2018 11:22 pm

Re: /etc/fstab + Mounting Drive = Error

Post by jaymot » Sun Apr 15, 2018 2:39 am

How would I mount a LUKS-encrypted partition? Same way?

Mint auto-mounts partitions in /media/jaymot/(uuid of partition) and I want to be able to specify the mount point, i.e. /media/jaymot/backup_drive, to make it humanly-understandable as to which drive is which as I have both an extra internal drive and an external one that I use.

Thanks.
Mint 19 Tara Cinnamon, Asus Zenbook UX303UB, 12GiB 1.6GHz DDR3 RAM, 1TiB HD, Intel Skylake & GeForce 940M 2GiB GPUs, Intel Core i7 6500U CPU

User avatar
smurphos
Level 13
Level 13
Posts: 4804
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: /etc/fstab + Mounting Drive = Error

Post by smurphos » Sun Apr 15, 2018 3:59 am

fabien85 wrote:
Sat Apr 14, 2018 5:42 am
Finally if you place an entry in the fstab, and the drive is not present at boot, then you will get an error. There is a way around that but I cant remember it at the moment.

Code: Select all

UUID=d00e8652-5707-4cf0-b2b6-71fdf569d93d  /media/ea234/HD4TBB  ext3  defaults  0  0
nofail flag

Code: Select all

UUID=d00e8652-5707-4cf0-b2b6-71fdf569d93d  /media/ea234/HD4TBB  ext3  defaults,nofail 0  0
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

lostwong
Level 1
Level 1
Posts: 1
Joined: Mon Apr 16, 2018 10:06 pm

Re: /etc/fstab + Mounting Drive = Error

Post by lostwong » Mon Apr 16, 2018 10:32 pm

The one other thing that I do when updating the fstab file is run "mount -a" before rebooting with a new fstab. It's helped identify syntax errors or other problems in my fstab file before rebooting.

For instance, if my fstab had this line in it:

Code: Select all

/dev/disk/by-label/backup /mnt/backup		ext4	defaults	1 2
And I didn't have the /mnt/backup folder, "mount -a"returns with the following error:

Code: Select all

# mount -a
mount: /mnt/backup: mount point does not exist.
Hope this helps the next time you need to make some mods to your fstab.

ea234
Level 1
Level 1
Posts: 4
Joined: Sun Mar 11, 2018 5:55 am
Location: Germany, Hamburg

Re: /etc/fstab + Mounting Drive = Error

Post by ea234 » Tue Apr 17, 2018 10:21 am

Problem solved,

thank you all for answering my question.

i did it with "Disks", wich i found in my German version as "Laufwerke".

So this is the final entry in my /etc/fstab-File

/dev/disk/by-uuid/d00e8652-5707-4cf0-b2b6-71fdf569d93d /media/HD4TBB auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=HD4TBB 0 0

I thought, that I have to create the Directory "HD4TBB" in the folder "/media" but that was not the case.

Eckbert

Post Reply

Return to “Hardware Support”