Saturday, February 24, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4942  / 1 Year ago, sat, october 29, 2022, 7:09:49

I'm running Kubuntu 12.04 with KDE 4.11.1. I have a 2TB hard drive mounted in an external USB enclosure. The drive label is Backup. The drive is not automatically mounted when I boot. There are two ways I wish to mount it:

  1. I have a root cron entry that will mount the drive if it is not already mounted. This is part of my nightly backup script.

  2. As a normal user, I can click the drive label in Dolphin's Places panel and the drive will be mounted.

Previously, the drive would mount at /media/Backup in both cases.

I manually created the directory /media/Backup previously and it still exists. The directory is required so that my backup script can mount this disk before the backup runs. As I said, this was working as intended before some recent system updates. I want the drive to mount at the same location in both the situations above.

However, with recent system updates (apparently the LTS Raring HWE stack) the drive mounts at /media/myusername/Backup from Dolphin if I mount it from Dolphin as a normal user. It mounts as /media/root/Backup if I mount it as root user.

There are a variety of ways this new Ubuntu scheme can fail under my scenario. In fact, it is rountinely failing and my nightly backups are not happening anymore. I won't list all the ways I have seen it fail in my troubleshooting so far. I would simply like to restore the previous behavior for this disk or achieve something that works reliably under the new system. Specifically, what I would like to see is:

  1. the drive isn't mounted at boot and isn't mounted unless/until needed.

  2. whether mounted by my normal user via Dolphin or via a script run as root, the drive is always mounted at the same place (so my backup script can find it).

  3. if the drive hasn't been mounted yet (i.e., via Dolphin), my backup script (run as root) is able to mount it at the intended location and then proceed with the backup.

  4. file permissions on files and directories on the mounted drive work as expected

Here's all I needed in my root crontab previously. I'd like to get this working again.

00 03 * * * mount -L Backup /media/Backup >> /var/log/backup.log
05 03 * * * /opt/storeBackup/bin/ -f /configfile

I prefer not to change my system-wide default behavior. Therefore, this solution doesn't seem ideal: (and I don't yet know if I have the udisk version that would support that solution).

I would appreciate comments on this possible solution:

More From » mount


I have given this answer, which may be the best approach. However, there is also a simpler solution based on the new default behavior of udisks2. Ubuntu's switch from udisks1 to udisks2 is what initially caused my problem. Rather than reverting to the udisks1 behavior, I found a way to use the new default behavior to my advantage.

The key to the solution is that both of the following mounts (for the same device) can co-exist:

  • /media/myusername/Backup

  • /media/root/Backup

Therefore, if I change my backup scripts to use /media/root/Backup and to always mount the device at that location before the backup, my issue is solved. I can continue to use Dolphin the way I do now and I can live with the default (non-root) mount location of /media/myusername/Backup. They do not appear to conflict with each other.

I was striving to avoid having two mounts for one device, but after testing this option I find that it seems to work fine. It solves the backup problems I was seeing.

Unless anyone knows of problems from this approach it may be my preferred approach because it doesn't change the new default behavior, it doesn't rely on any scripts (which always require maintenance over time) and it assures that my backup will not fail due to the device not being mounted.

[#29716] Saturday, October 29, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 11
Total Questions: 121
Total Answers: 109

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago