Discussion:
[rsnapshot-discuss] no_create_root doesn't work the way I think it should
brad
2012-05-09 04:11:27 UTC
Permalink
I'm backing up to an external, encrypted, USB hard drive from cron. I
have:
snapshot_root /media/Maxtor-1/
no_create_root 1

The hard drive gets mounted as /media/Maxtor-1. Occasionally root will
get filled up by the backup, written to a directory /media/Maxtor-1, so
it appears to me that it is creating the snapshot_root. This happens
when the ext hard drive doesn't get mounted for some reason. Am I
misunderstanding no_create_root or is this a bug?

I'm using rsnapshot 1.3.0 on ubuntu 10.04
Ronny
2012-05-09 05:26:14 UTC
Permalink
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron. I
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root will
get filled up by the backup, written to a directory /media/Maxtor-1, so
it appears to me that it is creating the snapshot_root. This happens
when the ext hard drive doesn't get mounted for some reason. Am I
misunderstanding no_create_root or is this a bug?
Hallo Brad,

no_create_root means that if your rsnapshots root directory is
/media/Maxtor-1, that this directory will not be created if it is
missing. In your case, the directory is always present. So if your
external drive is not mounted, the directory exists anyway and rsnapshot
starts to work. one solution would be to use a subfolder on your
external drive "rsnapshots" or "backups" as root
(media/Maxtor-1/backups). So if the drive is not mounted, the subfolder
is not found and no_create_root works as aspected. Another solution
would be an udev rule, which created the directory /media/Maxtor-1 when
the external drive is pluged in and deletes the folder when the device
was removed, so the directory does not exist when the drive is not present.

Regards Ronny
David Keegel
2012-05-09 11:59:35 UTC
Permalink
Post by Ronny
no_create_root means that if your rsnapshots root directory is
/media/Maxtor-1, that this directory will not be created if it is
missing. In your case, the directory is always present. So if your
external drive is not mounted, the directory exists anyway and rsnapshot
starts to work. one solution would be to use a subfolder on your
external drive "rsnapshots" or "backups" as root
(media/Maxtor-1/backups). So if the drive is not mounted, the subfolder
is not found and no_create_root works as aspected.
To me, this simple solution (use a sub-directory as the snapshot root,
not the mount point itself) is the best. It also means you don't end
up with a lost+found directory inside your snapshot root.
--
___________________________________________________________________________
David Keegel <***@cyber.com.au> Cyber IT Solutions Pty. Ltd.
http://www.cyber.com.au/~djk/ Linux & Unix Systems Administration
Helmut Hullen
2012-05-09 07:24:00 UTC
Permalink
Hallo, brad,
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron.
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root
will get filled up by the backup, written to a directory
/media/Maxtor-1, so it appears to me that it is creating the
snapshot_root. This happens when the ext hard drive doesn't get
mounted for some reason. Am I misunderstanding no_create_root or is
this a bug?
"Ronny" has told the most informations. He propose a udev rule for
checking wether the target is mounted; I work with a "wrapper" script
which first tests wether the target is mounted and then calls
"rsnapshot".

And for USB devices I prefer working with "LABEL" for checking the right
target.

Viele Gruesse!
Helmut
Helmut Hullen
2012-05-09 07:24:00 UTC
Permalink
Hallo, brad,
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron.
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root
will get filled up by the backup, written to a directory
/media/Maxtor-1, so it appears to me that it is creating the
snapshot_root. This happens when the ext hard drive doesn't get
mounted for some reason. Am I misunderstanding no_create_root or is
this a bug?
"Ronny" has told the most informations. He propose a udev rule for
checking wether the target is mounted; I work with a "wrapper" script
which first tests wether the target is mounted and then calls
"rsnapshot".

And for USB devices I prefer working with "LABEL" for checking the right
target.

Viele Gruesse!
Helmut
Helmut Hullen
2012-05-09 07:24:00 UTC
Permalink
Hallo, brad,
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron.
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root
will get filled up by the backup, written to a directory
/media/Maxtor-1, so it appears to me that it is creating the
snapshot_root. This happens when the ext hard drive doesn't get
mounted for some reason. Am I misunderstanding no_create_root or is
this a bug?
"Ronny" has told the most informations. He propose a udev rule for
checking wether the target is mounted; I work with a "wrapper" script
which first tests wether the target is mounted and then calls
"rsnapshot".

And for USB devices I prefer working with "LABEL" for checking the right
target.

Viele Gruesse!
Helmut
Helmut Hullen
2012-05-09 07:51:00 UTC
Permalink
Hallo, brad,
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron.
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root
will get filled up by the backup, written to a directory
/media/Maxtor-1, so it appears to me that it is creating the
snapshot_root. This happens when the ext hard drive doesn't get
mounted for some reason. Am I misunderstanding no_create_root or is
this a bug?
"Ronny" has told the most informations. He proposes a udev rule for
checking wether the target is mounted; I work with a "wrapper" script
instead which first tests wether the target is mounted and then calls
"rsnapshot".

And for USB devices I prefer working with "LABEL" for checking the right
target.

Viele Gruesse!
Helmut
Helmut Hullen
2012-05-09 07:51:00 UTC
Permalink
Hallo, brad,
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron.
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root
will get filled up by the backup, written to a directory
/media/Maxtor-1, so it appears to me that it is creating the
snapshot_root. This happens when the ext hard drive doesn't get
mounted for some reason. Am I misunderstanding no_create_root or is
this a bug?
"Ronny" has told the most informations. He proposes a udev rule for
checking wether the target is mounted; I work with a "wrapper" script
instead which first tests wether the target is mounted and then calls
"rsnapshot".

And for USB devices I prefer working with "LABEL" for checking the right
target.

Viele Gruesse!
Helmut
c***@ccs.covici.com
2012-05-09 07:38:57 UTC
Permalink
You should use a directory which is only on your external disk, but the
one you are using is around all the time as the mount point. Also, I
would use a shell script and check the return code from mount anyway.
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron. I
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root will
get filled up by the backup, written to a directory /media/Maxtor-1, so
it appears to me that it is creating the snapshot_root. This happens
when the ext hard drive doesn't get mounted for some reason. Am I
misunderstanding no_create_root or is this a bug?
I'm using rsnapshot 1.3.0 on ubuntu 10.04
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici
***@ccs.covici.com
David Cantrell
2012-05-09 11:21:48 UTC
Permalink
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron. I
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root will
get filled up by the backup, written to a directory /media/Maxtor-1, so
it appears to me that it is creating the snapshot_root. This happens
when the ext hard drive doesn't get mounted for some reason. Am I
misunderstanding no_create_root or is this a bug?
It's neither :-)

What you're misunderstanding is what happens when a volume is mounted.

For a volume to be mounted, the place in the filesystem that it is to be
mounted at must already exist as a directory. So, at some point that
directory had to get created. Consumerish OSes like Ubuntu and are often
user-friendly enough to make that transparent, by silently creating the
directory for you on demand, and removing it afterwards. However, those
operations are not atomic with the mount and unmount, so there is a
brief period of time where the directory exists but the volume isn't
mounted. If during that period anything gets put in the directory, it
won't be removed, and the directory will then exist for ever until you
manually remove it. And if it's already there, then rsnapshot will
happily use it.
--
David Cantrell | Godless Liberal Elitist

EINE KIRCHE! EIN KREDO! EIN PAPST!
brad
2012-05-09 14:38:38 UTC
Permalink
Thanks to all who have commented. I turned off the hard drive &
rebooted & the directory does not exist right now, so I think David's
observation is what has happened. It seems like this happens when I log
in at the same time that cron runs rsnapshot. It sounds like just
creating a Backup directory on the device and using that as root will be
sufficient?
Post by David Cantrell
Post by brad
I'm backing up to an external, encrypted, USB hard drive from cron. I
snapshot_root /media/Maxtor-1/
no_create_root 1
The hard drive gets mounted as /media/Maxtor-1. Occasionally root will
get filled up by the backup, written to a directory /media/Maxtor-1, so
it appears to me that it is creating the snapshot_root. This happens
when the ext hard drive doesn't get mounted for some reason. Am I
misunderstanding no_create_root or is this a bug?
It's neither :-)
What you're misunderstanding is what happens when a volume is mounted.
For a volume to be mounted, the place in the filesystem that it is to be
mounted at must already exist as a directory. So, at some point that
directory had to get created. Consumerish OSes like Ubuntu and are often
user-friendly enough to make that transparent, by silently creating the
directory for you on demand, and removing it afterwards. However, those
operations are not atomic with the mount and unmount, so there is a
brief period of time where the directory exists but the volume isn't
mounted. If during that period anything gets put in the directory, it
won't be removed, and the directory will then exist for ever until you
manually remove it. And if it's already there, then rsnapshot will
happily use it.
Loading...