0

Is there a way to copy files from a mounted point to the original directory of this mounted point ?

for example : I got a samba share mounted on /home/vod/public.

I lost my connection so I have no more access to the samba share, My goal is to do a 'Backup' of this samba share, so when I lose connection, I umount the samba share.

And an old copy of the samba share is at the original directory (/home/vod/public)

I saw than you can access to the original contents of a mount point with the option --bind when you mount it, but what about copying from the share to the original content ?

1 Answer 1

0

The mountpoint is /home/vod/public. Prepare an empty directory /somewhere/else/. Then:

mount --bind /home/vod /somewhere/else

With --bind (as opposed to --rbind, see man 8 mount) public in /somewhere/else will not replicate the mounted public of /home/vod.

However you should find /somewhere/else/public as a directory, probably empty. This directory is what /home/vod/public had been before the samba share was mounted there.

Now copy whatever you want from /home/vod/public to /somewhere/else/public to create a local copy. When finished, unmount /somewhere/else:

umount /somewhere/else

From now on, if you umount /home/vod/public (or not mount after restart in the first place) then /home/vod/public will be the local public directory you have copied to.


Note if you lose the connection then programs already using files from the share will not be transparently rerouted to respective local copies, even if you manage to unmount the share. They will need to open the files by path anew.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .