fstab entry not producing desired results.

Asked by Bill

# fstab entry not producing desired results.

# the ultimate goal is to use a backup script to mount, backup, and unmount a file system.
#

running XUBUNTU with the Thunar file manager

sb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise

uname -a
Linux bill-laptop 3.2.0-65-generic #99-Ubuntu SMP Fri Jul 4 21:04:27 UTC 2014 i686 i686 i386 GNU/Linux

# can mount and unmount /media/Backup via the file manager.

bill@bill-laptop:/media$ cat /etc/mtab
/dev/sda1 / ext4 rw,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
gvfs-fuse-daemon /home/bill/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=bill 0 0
gvfs-fuse-daemon /root/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev 0 0
/dev/sdb2 /media/BackUp ext4 rw,nosuid,nodev,uhelper=udisks 0 0 <<-------------

# mounting at terminal

bill@bill-laptop:/media$ sudo mount /dev/sdb2 /media/BackUp
mount: mount point /media/BackUp does not exist <<-----------------

# creating mount point

bill@bill-laptop:/media$ sudo mkdir /media/BackUp
bill@bill-laptop:/media$ sudo mount /dev/sdb2 /media/BackUp
bill@bill-laptop:/media$ sudo chown 1000:1000 /media/BackUp
bill@bill-laptop:/media$ chmod 775 /media/BackUp
bill@bill-laptop:/media$ ls -l
total 4
drwxrwxr-x 4 bill bill 4096 Jun 28 21:12 BackUp
bill@bill-laptop:/media$ ls -l BackUp/
total 2683080
-rw-r--r-- 1 root root 408203914 May 27 20:53 5-27-2014.tar.gz
-rw-r--r-- 1 root root 383927136 Jun 16 21:13 6-16-2014.tar.gz
-rw-r--r-- 1 root root 1955313970 Jun 28 20:48 6-28-2014.tar.gz
drwx------ 2 root root 16384 May 25 15:24 lost+found

# works okay and then unmount is okay

bill@bill-laptop:/media$ umount /media/BackUp
umount: /media/BackUp is not in the fstab (and you are not root)
bill@bill-laptop:/media$ sudo umount /media/BackUp
bill@bill-laptop:/media$ ls -l
total 4
drwxr-xr-x 2 root root 4096 Jul 8 16:02 BackUp
bill@bill-laptop:/media$ ls -l BackUp/
total 0

# mount via thunar file manager still works but now mounted to "BackUp_"

bill@bill-laptop:/media$ ls -l
total 8
drwxr-xr-x 2 root root 4096 Jul 8 16:02 BackUp
drwxrwxr-x 4 bill bill 4096 Jun 28 21:12 BackUp_
bill@bill-laptop:/media$ ls -l BackUp
total 0
bill@bill-laptop:/media$ ls -l BackUp_
total 2683080
-rw-r--r-- 1 root root 408203914 May 27 20:53 5-27-2014.tar.gz
-rw-r--r-- 1 root root 383927136 Jun 16 21:13 6-16-2014.tar.gz
-rw-r--r-- 1 root root 1955313970 Jun 28 20:48 6-28-2014.tar.gz
drwx------ 2 root root 16384 May 25 15:24 lost+found

# unmount via Thunar file manager, "BackUp_" is now gone.

bill@bill-laptop:/media$ ls -l
total 4
drwxr-xr-x 2 root root 4096 Jul 8 16:02 BackUp

# mount from terminal

bill@bill-laptop:/media$ mount /media/BackUp/
mount: can't find /media/BackUp/ in /etc/fstab or /etc/mtab

# determine UUID

bill@bill-laptop:/media$ blkid
/dev/sdb1: LABEL="Boot2" UUID="909a0618-536d-4cc2-8ea9-3fa06f3e63f3" TYPE="ext4"
/dev/sdb2: LABEL="BackUp" UUID="dcd9f11a-0a09-493f-8fad-16c14b3d7ede" TYPE="ext4" <<----------------
/dev/sdb3: LABEL="DiskC" UUID="4d94f320-af65-4d57-b97d-2cb33a8b474c" TYPE="ext4"
/dev/sda1: UUID="e1208bf4-aa87-4e54-b51f-5625e7957e33" TYPE="ext4"
/dev/sda5: UUID="1e175449-e90f-4355-8672-dc4e947b626f" TYPE="swap"

# enter info into /etc/fstab

# mount removable hd for backups
UUID=dcd9f11a-0a09-493f-8fad-16c14b3d7ede /media/BackUp ext4 rw,nosuid,nodev,users,uhelper=udisks 0 0

# mount from terminal, no "BackUp_" file, mount okay.

bill@bill-laptop:/media$ mount /media/BackUp/
bill@bill-laptop:/media$ ls -l
total 4
drwxrwxr-x 4 bill bill 4096 Jun 28 21:12 BackUp
bill@bill-laptop:/media$ ls -l BackUp/
total 2683080
-rw-r--r-- 1 root root 408203914 May 27 20:53 5-27-2014.tar.gz
-rw-r--r-- 1 root root 383927136 Jun 16 21:13 6-16-2014.tar.gz
-rw-r--r-- 1 root root 1955313970 Jun 28 20:48 6-28-2014.tar.gz
drwx------ 2 root root 16384 May 25 15:24 lost+found

# unmount from terminal and NOT okay

bill@bill-laptop:/media$ umount /media/BackUp
Unmount failed: Error unmounting: umount exited with exit code 1: helper failed with: <<----------------

bill@bill-laptop:/media$ ls -l
total 4
drwxrwxr-x 4 bill bill 4096 Jun 28 21:12 BackUp
bill@bill-laptop:/media$ ls -l BackUp/
total 2683080
-rw-r--r-- 1 root root 408203914 May 27 20:53 5-27-2014.tar.gz
-rw-r--r-- 1 root root 383927136 Jun 16 21:13 6-16-2014.tar.gz
-rw-r--r-- 1 root root 1955313970 Jun 28 20:48 6-28-2014.tar.gz
drwx------ 2 root root 16384 May 25 15:24 lost+found

# removed line from fstab and umount is okay again.

# added line back in fstab and now mount requires sudo

bill@bill-laptop:/media$ sudo mount /dev/sdb2 /media/BackUp
[sudo] password for bill:
bill@bill-laptop:/media$ ls -l
total 4
drwxrwxr-x 4 bill bill 4096 Jun 28 21:12 BackUp
bill@bill-laptop:/media$ ls -l BackUp/
total 2683080
-rw-r--r-- 1 root root 408203914 May 27 20:53 5-27-2014.tar.gz
-rw-r--r-- 1 root root 383927136 Jun 16 21:13 6-16-2014.tar.gz
-rw-r--r-- 1 root root 1955313970 Jun 28 20:48 6-28-2014.tar.gz
drwx------ 2 root root 16384 May 25 15:24 lost+found

# unmount is okay

bill@bill-laptop:/media$ umount /media/BackUp

# with fstab entry back in place, Thunar unmount fails with the following message

Failed to eject "BackUp".
Error unmounting: unount exited <<----------------
with exit code 1: helper failed with:

# unmount from terminal produces the same error and the unmount fails.

###########################################

okay, how to I get Thunar and a script to play nice and mount this file system?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Bill
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

What is the file protection and ownership of /media/BackUp when the disk is NOT mounted?

Revision history for this message
Bill (papakujawa) said :
#2

Manfred, Thank you. I believe your question pushed me in the right direction. At least Thunar and a non-root user can mount and unmount the file system.

# Set ownership to me as a user. Set full read/write access.

bill@bill-laptop:/media$ ls -l
total 4
drwxr-xr-x 2 root root 4096 Jul 8 16:02 BackUp
bill@bill-laptop:/media$ sudo chmod 777 BackUp/
bill@bill-laptop:/media$ sudo chown bill:bill BackUp/
bill@bill-laptop:/media$ ls -l
total 4
drwxrwxrwx 2 bill bill 4096 Jul 8 16:02 BackUp

# set fstab to the following and removing the "uhelper=udisks":

UUID=dcd9f11a-0a09-493f-8fad-16c14b3d7ede /media/BackUp ext4 rw,nosuid,nodev,users,owner,noauto 0 0

# Question, this works but is any of this not necessary or out of place? Let me know and I will close this question.

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Changing the protection settings to allow write for everyone AND setting the ownership to your user is somewhat double. Doing one of these should have been enough. This will not do any harm, anyhow, it just allows access to your backup directory for all other users of that system (if there are any).

Just as last step: you might re-check the file ownership of your old backup files, they might have root as owner instead of bill. Just sudo chown them if applicable.

Everything else looks file to me.

Revision history for this message
Bill (papakujawa) said :
#4

Manfred,

Thanks for the help and suggestions. Changed the protections settings of /media/BackUp to 755 and set myself as the owner of my backup files.

Bill Kujawa