[Techtalk] ln and unmounted directories

Maria Blackmore mariab at cats.meow.at
Thu Jun 5 23:07:26 EST 2003


On Thu, 5 Jun 2003, Emma Jane Hogbin wrote:

> I have a backup directory that, for safe keeping, I don't mount unless I
> need something from it. It has a copy of my kernel, some kernel patches, 
> config files, etc. Instead of only copying files into that directory I'm
> thinking about creating a set of files with hard links. I'm not sure if
> this would work though.

Hi,

First things first, you cannot hard link across filesystems, a hard link
has to stay within a single filesystem, you can, however soft link across
filesystems, but this won't help you much here :)

> 1) The files would only be in sync if the safety directory was mounted.
> To keep them in sync could I mount the safety directory whenever I updated
> a config file?

Uhm, I'm not quite sure what you mean, here.

I think what you could do is keep the files on this particular filesystem,
but only mount the filesystem as read/write when you need to change it,
and keep it mounted as readonly at all other times.

You can use "mount -o remount,rw <filesystem>" to mount read/write, and
"mount -o remount,ro <filesystem>" to mount as readonly.  Both of these
will change the state of the mount without affecting files open on it.

All you need to do is change the entry for the filesystem in your fstab to
read "defaults,ro" in the options column, instead of just "defaults"

> 2) If the original file was deleted, what would happen to the files in the
> safety directory?

er ... k

Another option you have is to keep a directory with backups in, on
whatever filesystem you chose, and then use rsync
(http://rsync.samba.org/) to keep the files synchronised, as appropriate.

Or you can put a cronjob in that copies the files/directories/whatever to
the backup directory, with a -$DATE suffix.  eg

cp /etc/apache/httpd.conf /mnt/backups/httpd-`date +%Y%m%d`

the "date +%Y%m%d" command outputs the date as 20030605, for today

The ultimate option for this is to keep offsite backups :)

eg, purchase a shell account with a small quantity of disc space, you can
then regularly upload (encrypted) copies of important files, to be kept
safe for you :)

Maria




More information about the Techtalk mailing list