0

I have problems understanding the following.

In /etc/fstab I've mounted an external storage volume with:

//xyz.backup.com/backup /home/me/external_backup_volume cifs user=xyz,password=xyz,users 0 0

Daily I'm syncing files from a local folder to the mount point:

rsync --progress -arnz /backup /home/me/external_backup_volume

When I unmount /home/me/external_backup_volume I still see subdirectory and folders. Are the files still available even when the backup storage is unmounted? From ls -al it looks like but If I check df with the drive mounted and not the local disc usage of /dev/md2 does not change:

me@Ubuntu-1804-bionic-64-minimal:~$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
udev                              16G     0   16G   0% /dev
tmpfs                            3.2G  1.1M  3.2G   1% /run
/dev/md2                         436G  105G  310G  26% /
tmpfs                             16G  8.0K   16G   1% /dev/shm
tmpfs                            5.0M     0  5.0M   0% /run/lock
tmpfs                             16G     0   16G   0% /sys/fs/cgroup
/dev/md1                         488M  204M  259M  45% /boot
tmpfs                            3.2G     0  3.2G   0% /run/user/1000
//xyz.backup.com/backup          100G   46G   55G  46% /home/me/external_backup_volume

me@Ubuntu-1804-bionic-64-minimal:~$ umount /home/me/external_backup_volume
me@Ubuntu-1804-bionic-64-minimal:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  1.1M  3.2G   1% /run
/dev/md2        436G  105G  310G  26% /
tmpfs            16G  8.0K   16G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/md1        488M  204M  259M  45% /boot
tmpfs           3.2G     0  3.2G   0% /run/user/1000

So why do I still see the files when the drive is unmounted?

  • Where do you still see subdirectory and folders? If this is in your file manager, the list of folders is likely cached, or just that the file manager has not refreshed the list of directories in your current view. If the volume is unmounted, you should not be able to access the files. What happens when you try to open a file when unmounted? – Nmath Jul 13 at 20:53
  • thanks a lot for your reply. It's a Ubuntu server without a graphical interface. so I umount but can still cat the content of a file :/ strange as the drive is not listet under df anymore! – t Book Jul 13 at 20:56
  • 3
    Likely you have run your rsync backup at a time where your bckup drive wasn't mounted. Make sure that the drive IS unmounted, then you can removed the directories and files in /home/me/external_backup_volume. – Soren A Jul 13 at 21:00
  • I've checked the folder location $ df -P /home/me/external_backup_volume | tail -1 | cut -d' ' -f 1. When mounted it's stored at //xyz.backup.com/backup when unmounted to /dev/md2 – t Book Jul 13 at 21:01
  • @SorenA this sounds like a possible solution! – t Book Jul 13 at 21:02
1

Mounting a remote share (or a partition)

To mount a remote share (or a partition of a hard drive), you first need to have a local folder in the location where you want to mount that partition or remote share.

In your case, /home/me/external_backup_volume means a local folder named external_backup_volume must have been created (by you) in your Home folder /home/me/.

When the remote share is unmounted...

The folder /home/me/external_backup_volume is just a local folder in the server. It should be empty. However, it is just a local folder like any other local folder. This means you can create sub-folders in it and put files in it.

If you put files in this local folder you won't be able to see or access them when the remote share is mounted.

What happens when the remote share is unmounted?

The local folder /home/me/external_backup_volume is exposed. This can happen by accident. May be network was down. Or you had forgotten that you had unmounted the share when you ran the rsync command. As a result rsync copied the contents of the /backup folder into the local folder instead of into the remote share where you wanted it to be copied.

That is the reason you find a copy of the contents of your /backup folder in the local folder /home/me/external_backup_volume when the remote share is unmounted. You can go through the files to figure out when this may have happened. You can also empty the local folder /home/me/external_backup_volume.

Just make sure the remote share is not mounted when you "empty" the local folder. Because if the remote share is mounted, then you will be emptying the contents of the remote share, not the local folder.

In the future you may want to make sure that the remote share is mounted before you run the rsync and once again after rsync has completed just to make sure all the files went to the remote share, and not in the local folder.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.