0

I have installed two hard drives into my computer. One is running Ubuntu and the other one I have planned to use for backup.

I set up the backup job in Backups, but when I restarted I got the error Backup Failed.

enter image description here

My guess is that the disk was not mounted, and that it only becomes mounted after I go to "Other Locations" and click on the disk (so its mounted like a USB memory stick, and not a hard drive). enter image description here

How can I make sure that my hard drive is correctly mounted so that Backup works? I have Ubuntu 17.10.

Edit

Here is a screen shot of Disks: enter image description here

Edit

Print out from /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme0n1p1 during installation
UUID=0602af3b-b971-4014-91c1-dcb6fe7cec18 /boot           ext4    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
/dev/disk/by-uuid/5898e1d1-0683-4076-b854-64394cc1c973 /mnt/5898e1d1-0683-4076-b854-64394cc1c973 auto nosuid,nodev,nofail,x-gvfs-show 0 0
Solo
  • 883

2 Answers2

1

General description how to mount via /etc/fstab

You can mount the target partition for the backup via a line in /etc/fstab.

Mounted all the time

If the target partition is in an internal drive, and/or you want the partition to be mounted all the time, you can use the instructions in this link,

How to create partition for data?

Connected and mounted only during backup

If the target partition is in an external drive, you can add the mount option noauto so that you need not have it connected and running all the time.

This means that you can mount it manually with a command line (in a terminal window) before starting to use it, and the mount will be controlled by the line in /etc/fstab in a reliable way.

In the line add noauto after defaults like this: defaults,noauto as the fourth field in fstab. See man fstab for more details.

The examples in the link would be modified to

if ext4 file system

UUID=a3b3f4a4-3d6e-4d4e-7e1a-c2f0de792f90 /media/sindre/Backup ext4 defaults,noauto 0 2

if ntfs file system

In this case you might add some mount options instead of 'defaults'

UUID=56CA491D4B13782A /media/sindre/Backup ntfs noauto,rw,users,umask=022 0 2

and of course you should use your own data for the UUID and mount point.

This new line with be used after reboot.

Mount and unmount

These commands will work, when the line is there in /etc/fstab

  • before backup:

      sudo mount /media/sindre/Backup
    
  • after backup you can unmount

      sudo umount /media/sindre/Backup
    

When successfully unmounted, you can turn off and disconnect the drive.

Details

Create a mountpoint (only once)

sudo mkdir /media/sindre/Backup

Edit a line similar to one of the lines above into /etc/fstab. Use this command

sudo blkid

to identify the UUID of the data partition. Use it without quotes. Start the editor (nano)

sudo nano /etc/fstab

and add/edit this line modified with your data partition's UUID and file system.

Edit

I noticed/realized that you have wrtten the UUID of the drive in the second edit of your original question. I have edited it, and I suggest the following /etc/fstab file,

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme0n1p1 during installation
UUID=0602af3b-b971-4014-91c1-dcb6fe7cec18 /boot           ext4    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0

1. the backup drive from your example (original)

#/dev/disk/by-uuid/5898e1d1-0683-4076-b854-64394cc1c973 /mnt/5898e1d1-0683-4076-b854-64394cc1c973 auto nosuid,nodev,nofail,x-gvfs-show 0 0

2. the backup drive with small modifications from your example

#UUID=5898e1d1-0683-4076-b854-64394cc1c973 /mnt/5898e1d1-0683-4076-b854-64394cc1c973 ext4 auto,nosuid,nodev,nofail,x-gvfs-show 0 2

3. close to what I suggested at first in my answer (select and modify to fit what you need

uncomment alias remove the # character from the beginning of the line that you want to use)

#UUID=5898e1d1-0683-4076-b854-64394cc1c973 /media/sindre/Backup ext4 defaults,noauto 0 2

I suggest that you try example #3, the last line by uncommenting it (remobe the # character from the beginning of the (last) line.

Feel free to try and/or modify any of the three candidate lines, but use only one of them each time. The other two should be 'commented away' with a #.

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Is there not any method of making sure that the disk is mounted all the time without editing the fstab file? I have a program named "Disks" on my Ubuntu. I took a screenshot of it and added to my question. – Solo Nov 10 '17 at 09:17
  • The Western Digital 500 GB drive seems to get semi-automatically mounted at /media/sindre/Backup, when you click on its icon. That's fine. I think SATA disks with ext4 file systems might be automounted by some linux systems, but not all, and you cannot really control it (it may change with the default settings of the software). A good alternative that gives you control is to use a line in the file /etc/fstab. This is what I use, and many other linux users too. – sudodus Nov 10 '17 at 09:50
  • The file /etc/fstab is already there in all installed Ubuntu systems to control the system partitions (root partition, maybe home and boot partitions). It is not too difficult to edit the file to add that line. - An alternative is to create a shellscript or alias to make it convenient to use the mount command, or maybe run the mount command automatically at startup or log in, sudo mount -U your-own-uuid-string /media/sindre/Backup. Maybe you would like to add some boot options, for example if the default permissions are not what you want. Tell me what you want :-) – sudodus Nov 10 '17 at 09:54
  • @Solo, If you provide the UUID of the ext4 partition in the backup drive, that was mounted at /media/sindre/Backup , I can suggest a line to enter into /etc/fstab. But you must find the UUID yourself via sudo blkid. (It is possble but not reliable to use the device specification /dev/sdx1 because the device letter x may vary depending on what is connected and how fast each device is identified by the system.) – sudodus Nov 10 '17 at 15:44
  • I can try to type it from the image, but there is a big risk for typing errors, so I would prefer a text mode copy and paste from the output of sudo blkid to your question. Add four spaces to the beginning of each line to render it as code. – sudodus Nov 10 '17 at 15:47
  • @Solo, I have edited my answer to add an edited version of your uploaded /etc/fstab. Your version was different to the syntax, that I use, and I suggest that you try my version, and come back here and tell me the result, good or bad. Remember to create the mount point. Good luck :-) – sudodus Nov 11 '17 at 17:29
0

I successfully just created a backup on my mounted drive following these steps.

  1. created mount point and change permissions (change user3 with your user name)
sudo mkdir /media/user3/my_backup_disk
sudo chown -R user3:user3 /media/user3/my_backup_disk

You should now be able to mount your partition by typing

sudo mount /dev/nvme0n1p5 /media/user3/my_backup_disk

And if you do a ls -la you should see that user3 own the directory

  1. Added partition to /etc/fstab, by adding a line like this (change the UUID with your partition uuid)
UUID=282a0fe8-0439-4023-b8f7-f3edf29267c7 /media/user3/my_backup_disk ext4 defaults 0 2
  1. Reboot and verify that the partition is automatically mounted
  2. Finally set the backup path to the folder you created at point 1, for me is /media/user3/my_backup_disk
  3. Run the backup or schedule it as you wish