[opensuse] OpenSUSE 12.3 : difficulty Log-On to my xfce desktop : failed restore of /home partition
Hello List - after using "rsync" to restore my home partition, i was unable to gain access. The message from [ i suppose] XDM was something like permission prob : not able access /home : trying / !! - upon using Midnight Commander as root , the ownerships and permissions of /home looked all right [ solved difficulty, by rsync whole-system restore ] - any ideas please what solution to XDM probs might be applicable ?? ........... thanks best regards -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Fri, 03 May 2013 10:41:40 +0300 ellanios82 ellanios82 wrote:
Hello List
Hi there
- after using "rsync" to restore my home partition, i was unable to gain access.
Can you please supply the exact commands that you used, including all flags and arguments? Writing "using rsync" leaves out a lot of very important context.
The message from [ i suppose] XDM was something like permission prob : not able access /home : trying / !!
Again, you've left out a lot of important details. It really helps a lot to have precise information on all error messages. They are important clues.
- upon using Midnight Commander as root , the ownerships and permissions of /home looked all right
What does "all right" mean? How about the structure? Did you check to see if you ended up with something like /home/home/...?
[ solved difficulty, by rsync whole-system restore ]
Okay, so the /home-only partition 'restore' failed but, fortunately for you :-) the entire-system 'restore' succeeded? Congratulations! Metaphorically mixing, I'm going to climb out on a limb here and make a stab in the dark: I'm thinking you introduced an omission or typo somewhere while entering your 'rsync' commands. 'rsync' is a great tool. I use it all the time so I know it requires some precision; some close attention to detail. It would help a lot if you could post the exact commands that you issued to create the backups and to attempt/implement the 'restores.' regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/03/2013 01:42 PM, Carl Hartung wrote:
a stab in the dark: I'm thinking you introduced an omission or typo somewhere while entering your 'rsync' commands. 'rsync' is a great tool. I use it all the time so I know it requires some precision; some close attention to detail.
It would help a lot if you could post the exact commands that you issued to create the backups and to attempt/implement the 'restores.'
- floundering around in the dark, i sadly have no record of my desperation :(( [ i do not think it was a /home/home error ] .................... my reserve backups were on a hard disk not normally mounted : - firstly, i mounted the reserve partition on mount-point /mnt - next i changed directory to /mnt - finally i gave the command as root : " rsync -avr ./ [source being /mnt ] / [target directory] " _________________________________ many thanks best regards -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/03/2013 01:42 PM, Carl Hartung wrote:
exact commands that you issued to create the backups and to attempt/implement the 'restores.' .......................
1) #!/bin/sh # # use rsync to backup /home to /dev/sda2 # mount -t ext4 /dev/sda2 /mnt_cron # df cd /home/pisti rsync -avr --delete --delete-after --exclude=/ /home/ /mnt_cron cd # cp /mnt_cron/etc/fstab.5bak /mnt_cron/etc/fstab df umount /mnt_cron cd ...................... 2) #!/bin/sh # # use rsync to backup WHOLE system / to /dev/sdb4 # mount -t ext4 /dev/sdb4 /mnt_cron # df cd rsync -avr --delete --delete-after --exclude=/dev/shm --exclude=/DVD --exclude=/media --exclude=/mnt --exclude=/mnt_cron --exclude=/proc --exclude=/run --exclude=subdomain --exclude=/sys --exclude=/tmp --exclude=/var/lib/ntp --exclude=/var/run --exclude=/var/tmp / /mnt_cron cd # cp /etc/fstab_4B_BAK /mnt_cron/etc/fstab # DEBUG DEBUG DEBUG - No Mount Point SDA4 df umount /mnt_cron cd .............. thank you so much best regards -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Fri, 03 May 2013 14:01:10 +0300 ellanios82 ellanios82 wrote:
- floundering around in the dark, i sadly have no record of my desperation :(( [ i do not think it was a /home/home error ]
Okay, this isn't as important now since your second 'restore' succeeded.
my reserve backups were on a hard disk not normally mounted :
- firstly, i mounted the reserve partition on mount-point /mnt
- next i changed directory to /mnt
- finally i gave the command as root :
" rsync -avr ./ [source being /mnt ] / [target directory] "
The first problem here could be recursion into '/mnt'. I don't do this so maybe if source_'/mnt' = target_'/mnt' no harm, no foul. Sounds feasible. I'm curious to know, however: What steps do you take to arrive at this point? Do you boot to rescue mode using the installation DVD? Do you switch to systemd's equivalent of 'runlevel 1'? (single user mode, no network, minimal processes; a.k.a. 'maintenance mode' in some OSes?) Also, the 'r' flag in this use case is redundant. It /may/ actually be harmful. '-a' means 'archive' mode, which preserves timestamps, owners and permissions, much like tar, and it is already explicitly recursive. If you then follow up with 'r', it is possible that the 'r' supersedes the preceding '-a', in which case you could get recursion without preservation of timestamps, owners and permissions. I'll leave it to you to test this hypothesis or others to clarify what the behavior will actually be under these circumstances.
On 05/03/2013 01:42 PM, Carl Hartung wrote:
exact commands that you issued to create the backups and to attempt/implement the 'restores.' <snipped> # use rsync to backup /home to /dev/sda2 # mount -t ext4 /dev/sda2 /mnt_cron # df cd /home/pisti
This 'cd' is redundant. You're declaring explicit 'source' and 'target' paths on the next line.
rsync -avr --delete --delete-after --exclude=/ /home/ /mnt_cron
See my note, above, regarding appending 'r' after the '-a'.
cd
Another redundant 'cd'.
# cp /mnt_cron/etc/fstab.5bak /mnt_cron/etc/fstab df umount /mnt_cron cd
Another redundant 'cd'. <snipped>
# use rsync to backup WHOLE system / to /dev/sdb4 # mount -t ext4 /dev/sdb4 /mnt_cron # df cd
Another redundant 'cd'.
rsync -avr --delete --delete-after --exclude=/dev/shm --exclude=/DVD --exclude=/media --exclude=/mnt --exclude=/mnt_cron --exclude=/proc --exclude=/run --exclude=subdomain --exclude=/sys --exclude=/tmp --exclude=/var/lib/ntp --exclude=/var/run --exclude=/var/tmp / /mnt_cron
Again: See my note, above, regarding appending 'r' after the '-a'. This is possible 'nit picking' or more a matter of personal habits, but I always wrap my excludes in single quotes (when I use them) e.g. --exclude='/somepath/' So, I gather you are taking 'live' snapshots from a running system and storing them in the running system, albeit on devices that aren't normally mounted. YMMV but I don't do it this way. I keep backups completely isolated from running systems in case of catastrophic hardware failures. Why? Because I once experienced a full system meltdown (literally) and learned a very hard lesson. However, if this method works for you and you're happy with it, don't change a thing. One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
cd
Another redundant 'cd'.
# cp /etc/fstab_4B_BAK /mnt_cron/etc/fstab # DEBUG DEBUG DEBUG - No Mount Point SDA4 df umount /mnt_cron cd
Another redundant 'cd'. For comparison, the backup routine I go through is as follows. Note: the number of partitions here has been reduced for clarity: boot to 'rescue mode' using installation media log in as 'root' (does not require password) cd /mnt mkdir sda2 sda3 sdb2 sdb3 mount /dev/sda2 sda2 && mount /dev/sda3 sda3 && \ mount /dev/sdb2 sdb2 && mount /dev/sdb3 sdb3 rsync -avAX --delete sda2/ sdb2 rsync -avAX --delete sda3/ sdb3 umount sda2 sda3 sdb2 sdb3 eject /dev/sr0 poweroff Once the power is off, I detach the external USB drive (sdb) and then boot the system. I don't bother with excludes for these reasons: First, hard drives are so large and fast, now, that the extra time and space consumed (in my specific case) are inconsequential. YMMV. Second, I can't tell you how many times I've had important data inadvertently omitted because their file names (or paths) included strings matching the exclude criteria. Lastly, sometimes I'm lazy or tired or in a hurry and prone to more typos. Writing and correcting (and re-correcting) long strings of excludes is too much work. Even when scripted, there's always the maintenance factor 'x' months or 'y' years down the road -- after significant changes in / additions to the installation. YMMV. hth & regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/03/2013 05:30 PM, Carl Hartung wrote:
I'm curious to know, however: What steps do you take to arrive at this point? Do you boot to rescue mode using the installation DVD?
- booted with OpenSUSE Live DVD ...................... So, I gather you are taking 'live' snapshots from a running system and storing them in the running system, albeit on devices that aren't normally mounted. YMMV but I don't do it this way. ___________________________________________ - indeed : do this throughout the day .............. - also use External usb Disk : consider these 'terrific' :)) ......................
I keep backups completely isolated from running systems in case of catastrophic hardware failures. Why? Because I once experienced a full system meltdown (literally) and learned a very hard lesson. However, if this method works for you and you're happy with it, don't change a thing. One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. >
........................
hth & regards, Carl
- much appreciated : thank you best regards -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2013-05-03 at 10:30 -0400, Carl Hartung wrote:
One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
I once destroyed a system when attempting to do backup. I was using - --delete and I wrote the wrong source and target directories - as both did not match, the destination was deleted. - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGFs/4ACgkQtTMYHG2NR9U+tQCeITZ+el+mmmQf2F3EXP2aEELg 5hUAn2pHi6l1JAIZrVkh3og4lJMYgCYe =vs98 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sun, 5 May 2013 03:21:02 +0200 (CEST) Carlos E. R. wrote:
On Friday, 2013-05-03 at 10:30 -0400, Carl Hartung wrote:
One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
I once destroyed a system when attempting to do backup. I was using - --delete and I wrote the wrong source and target directories - as both did not match, the destination was deleted.
Ouch! You're supposed to "engage your brain" [as in 'engaging' gears in a transmission] *before* tapping the 'Enter' key! ;-) This is precisely why I always, always, always _stop_ beforehand to read back and contemplate, to confirm, my typing _before_ committing to the operation. And, when this strategy fails, there is always the extra copy, right? So, when something horrible _does_ happen one can at least restore to a consistent state? Thanks for bringing up such a valuable point, Carlos. The partitions I omitted earlier, for "clarity," were precisely those containing the redundant copies of my backups. :-) regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carl Hartung said the following on 05/05/2013 12:31 AM:
On Sun, 5 May 2013 03:21:02 +0200 (CEST) Carlos E. R. wrote:
On Friday, 2013-05-03 at 10:30 -0400, Carl Hartung wrote:
One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
I once destroyed a system when attempting to do backup. I was using - --delete and I wrote the wrong source and target directories - as both did not match, the destination was deleted.
Ouch!
You're supposed to "engage your brain" [as in 'engaging' gears in a transmission] *before* tapping the 'Enter' key!
;-)
This is precisely why I always, always, always _stop_ beforehand to read back and contemplate, to confirm, my typing _before_ committing to the operation.
Indeed, but it helps if the documentation/man page is clear about such matters. personally I think the section on "delete" is so badly written that I don't understand it however much I stop and contemplate. My "commit" is simply not to use it. Perhaps I am crippling myself by not using the capabilities of rsync, but then again, I avoid a misunderstanding and hence avoid wiping my system. -- The radical of one century is the conservative of the next. The radical invents the views. When he has worn them out, the conservative adopts them. --Mark Twain -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sun, 05 May 2013 06:35:40 -0400 Anton Aylward wrote:
Carl Hartung said the following on 05/05/2013 12:31 AM:
On Sun, 5 May 2013 03:21:02 +0200 (CEST) Carlos E. R. wrote:
On Friday, 2013-05-03 at 10:30 -0400, Carl Hartung wrote:
One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
I once destroyed a system when attempting to do backup. I was using - --delete and I wrote the wrong source and target directories - as both did not match, the destination was deleted.
Ouch!
You're supposed to "engage your brain" [as in 'engaging' gears in a transmission] *before* tapping the 'Enter' key!
;-)
This is precisely why I always, always, always _stop_ beforehand to read back and contemplate, to confirm, my typing _before_ committing to the operation.
Indeed, but it helps if the documentation/man page is clear about such matters. personally I think the section on "delete" is so badly written that I don't understand it however much I stop and contemplate.
My "commit" is simply not to use it.
Perhaps I am crippling myself by not using the capabilities of rsync, but then again, I avoid a misunderstanding and hence avoid wiping my system.
I highly doubt you're "crippling" yourself, Anton. Obviously, other tools can be used. I'll say this, though: Once you've familiarized yourself with rsync enough to use it every day, it becomes an indispensable part of your toolkit. The biggest problem I had was figuring out that the last slash ('/') in the *source* path acts like a "container." From rsync's perspective, it determines at the outset what is (and is not) written to the target: /source/xyz Here, the last slash "contains" the directory "xyz". Used in this form, rsync will copy the directory "xyz" and it's contents to the target. /source/xyz/ Here, the last slash does _not_ "contain" the directory "xyz". Used in this form, only the contents of "xyz" are copied to the target. /target/xyz rsync treats both of these target paths equally, i.e. /target/xyz/ the trailing slash is implied when omitted. This is comparable to the behavior of 'cp', 'rm', 'rmdir', 'mv', etc. Also, I really only use the following options on a regular basis: -a, --archive archive mode Replicates the source directory, recursively, preserving owners, timestamps and permissions (sort of like 'tar' but the target is another directory instead of a file.) Add 'A' and 'X' flags to preserve, respectively, ACLs and extended attributes. Caveat: It operates exactly as stated above when invoked as root. When invoked by a regular user, it writes to the target as that user (local system.) -r, --recursive recurse into directories Recurse and preserve permissions, but not owners or timestamps (i.e. write as current user with current timestamps.) -v, --verbose increase verbosity -A, --acls preserve ACLs -X, --xattrs preserve extended attributes -n, --dry-run perform a trial run with no changes made I often use this option with redirection or piping to casually examine the results of a contemplated rsync operation. It causes rsync to undertake the operation without actually writing any changes to disk. piping example: rsync -rvn --delete /source/ /target | less redirection example: rsync -rvn --delete /source/ /target >somefilename.txt --delete delete extraneous files from destination --delete-during receiver deletes during the transfer --del an alias for --delete-during Notes regarding the above 'flavors' of '--delete': '--delete' deletes items from the target that are not (i.e. "no longer") present at the source. In my experience, this is functionally equivalent to '--delete-during', where writing of new and changed items and deletions occur sequentially, in the order they are evaluated. Omitting '--delete' actually precludes true synchronization since this leaves items untouched at the target when they're not (i.e. are "no longer") present at the source. This is akin to an incremental backup, where items are added and updated, never deleted. Some notes regarding the other 'flavors' of '--delete' which I actually don't ever use: --delete-before deletions occur before new and changed files are written --delete-delay deletions occur after new and changed files are written --delete-after deletions occur after new and changed files are written --delete-excluded delete exclusions from the destination This last one could be used to remove items from a target that were previously, inadvertently, copied for lack of an earlier '--exclude' directive. From what I've read, the other three are meant to satisfy more 'fringe' or obscure scenarios where remote targets have other than native *nix filesystem types, older rsync versions or rsync implementations running on other operating systems. I could be wrong, but that's my take on them ATM. regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2013-05-06 at 19:27 -0400, Carl Hartung wrote:
From what I've read, the other three are meant to satisfy more 'fringe' or obscure scenarios where remote targets have other than native *nix filesystem types, older rsync versions or rsync implementations running on other operating systems. I could be wrong, but that's my take on them ATM.
There is an option I like for backups: -c, --checksum skip based on checksum, not mod-time & size It is of course slower, but I think it is safer. - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGIQTsACgkQtTMYHG2NR9V48QCfcuO7nHbo7NEf7o5FPJibQVsH t9MAnR1GLGAxs3cnQakEKuMF6WHWPmCV =/Uv2 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carl Hartung said the following on 05/06/2013 07:27 PM:
On Sun, 05 May 2013 06:35:40 -0400 Anton Aylward wrote:
[...]
My "commit" is simply not to use it.
Ah, I meant the "delete" options.
Perhaps I am crippling myself by not using the capabilities of rsync, but then again, I avoid a misunderstanding and hence avoid wiping my system.
I highly doubt you're "crippling" yourself, Anton. Obviously, other tools can be used. I'll say this, though: Once you've familiarized yourself with rsync enough to use it every day, it becomes an indispensable part of your toolkit.
Actually I use rsync a lot, for moving stuff, usually in preference to 'cp' for a variety of reasons. Regular readers will recall that I use LVM. I often find it necessary to 'split' a nearly full file system. I can create a logical volume (aka partition) and put a file system there then move part of a tree onto it and after deleting the tree from the original FS mount the new partition and the tree there; adjusting the /etc/fstab to make it permanent. So you'd think I'd use the 'delete' options. Well, no. They aren't clear to me.
The biggest problem I had was figuring out that the last slash ('/') in the *source* path acts like a "container." From rsync's perspective, it determines at the outset what is (and is not) written to the target:
I think that is a learning hurdle for many people :-)
I often use this option with redirection or piping to casually examine the results of a contemplated rsync operation. It causes rsync to undertake the operation without actually writing any changes to disk.
piping example:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
redirection example:
rsync -rvn --delete /source/ /target >somefilename.txt
--delete delete extraneous files from destination
Not the source? So what does that mean?
--delete-during receiver deletes during the transfer
Does that only work, therefore, if you have a daemon 'receiver'? What does 'during' amount to>? Does that mean if an file of that name exists it is deleted rather than simply over-written? What about files that exist at the target but not at the source? Are they deleted?
--del an alias for --delete-during
Notes regarding the above 'flavors' of '--delete':
'--delete' deletes items from the target that are not (i.e. "no longer") present at the source. In my experience, this is functionally equivalent to '--delete-during', where writing of new and changed items and deletions occur sequentially, in the order they are evaluated.
My worry about this: it seems to be a sync of source and destination with the source being authoritative. That last sentence poses a problem in my mind about building the set of files ...
Omitting '--delete' actually precludes true synchronization since this leaves items untouched at the target when they're not (i.e. are "no longer") present at the source. This is akin to an incremental backup, where items are added and updated, never deleted.
Or you could call it a 'copy' from source to destination. Everything from the source gets copied to the destination. If there is already stuff at the destination then its there and stays there. Call it "accumulation'.
Some notes regarding the other 'flavors' of '--delete' which I actually don't ever use:
--delete-before deletions occur before new and changed files are written
--delete-delay deletions occur after new and changed files are written
--delete-after deletions occur after new and changed files are written
--delete-excluded delete exclusions from the destination
This last one could be used to remove items from a target that were previously, inadvertently, copied for lack of an earlier '--exclude' directive.
All this just confuses me further.
From what I've read, the other three are meant to satisfy more 'fringe' or obscure scenarios where remote targets have other than native *nix filesystem types, older rsync versions or rsync implementations running on other operating systems. I could be wrong, but that's my take on them ATM.
-- "If you want to know what a man's like, take a good look at how he treats his inferiors, not his equals." -- J.K. Rowling, _Harry Potter and the Goblet of Fire -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2013-05-06 at 21:36 -0400, Anton Aylward wrote:
Carl Hartung said the following on 05/06/2013 07:27 PM:
The biggest problem I had was figuring out that the last slash ('/') in the *source* path acts like a "container." From rsync's perspective, it determines at the outset what is (and is not) written to the target:
I think that is a learning hurdle for many people :-)
Absolutely O:-)
piping example:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
Yes, but mixed with the thousands of other things it does. And as there is no "--dry-run" above, by the time you notice it may be too late.
redirection example:
rsync -rvn --delete /source/ /target >somefilename.txt
--delete delete extraneous files from destination
Not the source? So what does that mean?
Not the source :-) Ok, I don't know the differences between the different variations of "delete" (after, during, etc). The important thing is that it deletes things in the target directory. What? An example is easier. Suppose you do a backup of a directory. Then you delete some files in the source directory, create new files, change other files - the typical use of a computer. A week later you do another backup of the same source and same target. Changed and new files will be copied to the destination, but the deleted files... what? They will simply remain in the backup copy. If you have to do a restore, it will be incorrect, because those files you deleted intentionally will be recovered. So what the delete option what it does is simply delete in the target directory those files from a previous backup that are no longer in the source directory. Ie, it ensures that both target and source contain the same things. Ok? :-)
Omitting '--delete' actually precludes true synchronization since this leaves items untouched at the target when they're not (i.e. are "no longer") present at the source. This is akin to an incremental backup, where items are added and updated, never deleted.
Or you could call it a 'copy' from source to destination. Everything from the source gets copied to the destination. If there is already stuff at the destination then its there and stays there. Call it "accumulation'.
Yes, but there is a better way - for backups. You can have a backup directory for week 1, another for week 2, etc. All of them contain only what was present at the time they were made, no more, no less. Deleted files during the week are in week_1 directory but not in week_2. So far, good, no? But this way you need to store several times the source directory, you need a lot of space. The trick is that those files that do not change during the week, instead of being copied again and again every week, instead a hard link is created. Ie, in week_2 say there is 'somefile' that is in fact a hard link to the same 'somefile' that is also in week_1. You don't get a file copied several times, you get a hardlink instead, saving a lot of space. There are scripts that handle this type of backups automatically, like "rsnapshot". But the functionality is that of "--link-dest" in rsync. Basically: rsync $OPTIONS --link-dest=$PREVIOUS $SOURCE/ $DESTINATION - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGIaRsACgkQtTMYHG2NR9U9VACdEdkbUiCVeOzgQRRN6AYevsNx JZ0AnA/WVYsRs9VaYKKwblhNAbmlHAkE =MSs7 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carlos E. R. said the following on 05/06/2013 10:38 PM:
On Monday, 2013-05-06 at 21:36 -0400, Anton Aylward wrote:
Carl Hartung said the following on 05/06/2013 07:27 PM:
piping example:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
Yes, but mixed with the thousands of other things it does. And as there is no "--dry-run" above, by the time you notice it may be too late.
Ouch! As in *O*U*C*H*!*!*!
redirection example:
rsync -rvn --delete /source/ /target >somefilename.txt
--delete delete extraneous files from destination
Not the source? So what does that mean?
Not the source :-)
So this isn't doing a "mv" type of operation where the source is deleted after copy. I use rsync as a form of "mv" where "mv" isn't up to it.
Ok, I don't know the differences between the different variations of "delete" (after, during, etc). The important thing is that it deletes things in the target directory. What? An example is easier.
Suppose you do a backup of a directory.
Then you delete some files in the source directory, create new files, change other files - the typical use of a computer.
A week later you do another backup of the same source and same target. Changed and new files will be copied to the destination, but the deleted files... what? They will simply remain in the backup copy.
Oh YES! Isn't that what a 'backup' means? How else might I be able to recover deleted files?
If you have to do a restore, it will be incorrect, because those files you deleted intentionally will be recovered.
Well, that's one view. Still have a copy of something that was deleted and getting it back is another.
Yes, but there is a better way - for backups.
Right. Install a carousel with tape changer and handler and ...
You can have a backup directory for week 1, another for week 2, etc. All of them contain only what was present at the time they were made, no more, no less. Deleted files during the week are in week_1 directory but not in week_2.
Or RCS or Subversion or Git. Or many more variations.
There are scripts that handle this type of backups automatically, like "rsnapshot". But the functionality is that of "--link-dest" in rsync.
Basically:
rsync $OPTIONS --link-dest=$PREVIOUS $SOURCE/ $DESTINATION
Well that isn't a lot of use for the use-cases I have. My use of rsync is across machines or moving a tree to a new partition to free up space. -- Associate yourself with men of good quality if you esteem your own reputation; for 'tis better to be alone than in bad company. --George Washington -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2013-05-07 at 09:46 -0400, Anton Aylward wrote:
Carlos E. R. said the following on 05/06/2013 10:38 PM:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
Yes, but mixed with the thousands of other things it does. And as there is no "--dry-run" above, by the time you notice it may be too late.
Ouch! As in *O*U*C*H*!*!*!
Wait, I was mistaken. The manual says: -n, --dry-run perform a trial run with no changes made so the "n" above in the command line is the dry-run option. I prefer using long options because they are easier to spot what they are, so I did not notice the 'n'.
A week later you do another backup of the same source and same target. Changed and new files will be copied to the destination, but the deleted files... what? They will simply remain in the backup copy.
Oh YES! Isn't that what a 'backup' means? How else might I be able to recover deleted files?
By keeping timestamped copies :-)
Yes, but there is a better way - for backups.
Right. Install a carousel with tape changer and handler and ...
Right. Together with the Ferrari in my parking lot. Yea. :-p
You can have a backup directory for week 1, another for week 2, etc. All of them contain only what was present at the time they were made, no more, no less. Deleted files during the week are in week_1 directory but not in week_2.
Or RCS or Subversion or Git.
Or many more variations.
Another one is "rdiff-backup". The older copies are converted to rdiff files, which are smaller. But more cpu time.
There are scripts that handle this type of backups automatically, like "rsnapshot". But the functionality is that of "--link-dest" in rsync.
Basically:
rsync $OPTIONS --link-dest=$PREVIOUS $SOURCE/ $DESTINATION
Well that isn't a lot of use for the use-cases I have. My use of rsync is across machines or moving a tree to a new partition to free up space.
Ah, yes, of course, rsync can be used for many different things. - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGJixwACgkQtTMYHG2NR9VxAQCfYpBvs49lS5horFoa1lWWrTg2 IosAn22UQ0Sp6Zr3ZcGYTdBPXRFWlxDc =4YCu -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, 06 May 2013 21:36:57 -0400 Anton Aylward wrote:
Carl Hartung said the following on 05/06/2013 07:27 PM:
On Sun, 05 May 2013 06:35:40 -0400 Anton Aylward wrote:
[...]
My "commit" is simply not to use it.
Ah, I meant the "delete" options.
That's a /huge/ difference, isn't it! ;-) <snipped>
Actually I use rsync a lot, for moving stuff, usually in preference to 'cp' for a variety of reasons.
Regular readers will recall that I use LVM. I often find it necessary to 'split' a nearly full file system. I can create a logical volume (aka partition) and put a file system there then move part of a tree onto it and after deleting the tree from the original FS mount the new partition and the tree there; adjusting the /etc/fstab to make it permanent.
So you'd think I'd use the 'delete' options. Well, no. They aren't clear to me.
To be fair, the '--delete' option isn't needed for the operation you've just described. There's nothing 'extraneous' to delete in the newly created logical volume and filesystem.
The biggest problem I had was figuring out that the last slash ('/') in the *source* path acts like a "container." From rsync's perspective, it determines at the outset what is (and is not) written to the target:
I think that is a learning hurdle for many people :-)
I can't for the life of me figure out /why/ that's true, after the fact, but it is.
I often use this option with redirection or piping to casually examine the results of a contemplated rsync operation. It causes rsync to undertake the operation without actually writing any changes to disk.
piping example:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
Yes. The verbose output (standard out) from this 'dry run' will be piped to 'less' instead of scrolling up and off the screen. Since 'dry run' effectively sends all writes to /dev/null, you have the benefit of previewing beforehand exactly what will be written (deletes and all) if the 'dry run' option is removed.
redirection example:
rsync -rvn --delete /source/ /target >somefilename.txt
'-rvn' is "verbose recursion and do a 'dry run'" As in the previous example of piping standard out to 'less', this method lets you open the text file and examine the consequences of a contemplated rsync operation in advance. I use this 'flavor' when the number of files is huge ('less' has it's limits.) I also often use this method to generate complete lists of the contents of directories and even partitions, especially when I'm studying problems ... when "what 'lives' where" sorts of questions come up.
--delete delete extraneous files from destination
Not the source? So what does that mean?
'--delete' options never affect the source, only the target.
--delete-during receiver deletes during the transfer
Does that only work, therefore, if you have a daemon 'receiver'?
No, it works the same way locally, too.
What does 'during' amount to?
I think all these 'flavors' of the '--delete' option actually yield the identical results, but they allow tailoring one's operations in relation to bandwidth. "during" implies and acts synchronously, which requires healthy enough bandwidth that the 'sender' can know in a timely fashion what is happening at the 'receiver' end. I think the "before", "delayed" and "after" 'flavors' are more asynchronous and are there to provide for situations where bandwidth is less abundant.
Does that mean if an file of that name exists
exists where?
it is deleted rather than simply over-written?
If a file exists only at the target and the '--delete' option is exercised, that file _will_ be deleted from the target.
What about files that exist at the target but not at the source? Are they deleted?
see above
--del an alias for --delete-during
Notes regarding the above 'flavors' of '--delete':
'--delete' deletes items from the target that are not (i.e. "no longer") present at the source. In my experience, this is functionally equivalent to '--delete-during', where writing of new and changed items and deletions occur sequentially, in the order they are evaluated.
My worry about this: it seems to be a sync of source and destination with the source being authoritative.
Absolutely! This is what you do if you want to create an exact copy of the 'master.' Don't exercise '--delete' if that isn't what you want.
That last sentence poses a problem in my mind about building the set of files ...
It's always a one-way street. rsync _never_ writes to the 'source', only to the 'target'. A hypothetical: Let's say you've inadvertently allowed two previously identical branches of a project to diverge from each other (I know this _never_ ever happens) such that there's a different mix of older and newer files in each. The only way out of this dilemma is to run a two pass synchronization, once in each direction, _without_ exercising the '--delete' option. This picks up the newest versions of each object in each directory and copies it to the other -- overwriting older files on the target when they exist.
Omitting '--delete' actually precludes true synchronization since this leaves items untouched at the target when they're not (i.e. are "no longer") present at the source. This is akin to an incremental backup, where items are added and updated, never deleted.
Or you could call it a 'copy' from source to destination. Everything from the source gets copied to the destination. If there is already stuff at the destination then its there and stays there. Call it "accumulation'.
'Cumulative' mode ;-) <snipped>
--delete-excluded delete exclusions from the destination
This last one could be used to remove items from a target that were previously, inadvertently, copied for lack of an earlier '--exclude' directive.
All this just confuses me further.
Okay, forget the three I've snipped out (at least until you're running over two paper cups and a string) but please focus on this last very useful one, '--delete-excluded': Here's the use case scenario: First pass: rsync -rv /set/of/files/ /backup You then realize all your C sources got copied over, too, and that isn't what you wanted. Here's what you do: rsync -rv --exclude='*.c' --delete-excluded /set/of/files/ /backup The '--exclude=' part defines the set of files that are _not_ to be copied to the target. The '--delete-excluded' bit tells rsync to delete files from the target which match the given '--exclude' criteria. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carl Hartung said the following on 05/06/2013 11:05 PM:
On Mon, 06 May 2013 21:36:57 -0400 Anton Aylward wrote:
Actually I use rsync a lot, for moving stuff, usually in preference to 'cp' for a variety of reasons.
Regular readers will recall that I use LVM. I often find it necessary to 'split' a nearly full file system. I can create a logical volume (aka partition) and put a file system there then move part of a tree onto it and after deleting the tree from the original FS mount the new partition and the tree there; adjusting the /etc/fstab to make it permanent.
So you'd think I'd use the 'delete' options. Well, no. They aren't clear to me.
To be fair, the '--delete' option isn't needed for the operation you've just described. There's nothing 'extraneous' to delete in the newly created logical volume and filesystem.
Indeed. But I do want to "delete" the now extraneous files in the old file system now that they have been moved to the newly created logical volume and file system. Thank you for clarifying that the "delete" options of rsync can't do this for me. Which gets back to my assertion about avoiding using it :-) -- Faith is to believe what you do not yet see; the reward for this faith is to see what you believe. -- St. Augustine Quotes -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, 2013-05-05 at 00:31 -0400, Carl Hartung wrote:
On Sun, 5 May 2013 03:21:02 +0200 (CEST) Carlos E. R. wrote:
On Friday, 2013-05-03 at 10:30 -0400, Carl Hartung wrote:
One other item: I use the flags '-avAX' followed by '--delete' without the '--delete-after'. More below.
I once destroyed a system when attempting to do backup. I was using - --delete and I wrote the wrong source and target directories - as both did not match, the destination was deleted.
Ouch!
You're supposed to "engage your brain" [as in 'engaging' gears in a transmission] *before* tapping the 'Enter' key!
;-)
Oh, absolutely, but mistakes do happen. Actually, my intention as I recall, was to test rsync procedures to find out the correct incantation to use, or to verify the backup, or something of the sort.
This is precisely why I always, always, always _stop_ beforehand to read back and contemplate, to confirm, my typing _before_ committing to the operation.
And I did... O:-)
And, when this strategy fails, there is always the extra copy, right? So, when something horrible _does_ happen one can at least restore to a consistent state?
Yes, but it was much older. You see, I was doing a backup... it was not done yet. The disaster hit at the worst point possible. I don't remember now the exact details, how I recovered. I lost /var and other things randomly. I think I copied things from another system, then used rpm verify to replace things, or restored the old backup and then upgraded. I posted about it somewhere. Ah, here: https://forums.opensuse.org/english/get-technical-help-here/applications/477...
Thanks for bringing up such a valuable point, Carlos. The partitions I omitted earlier, for "clarity," were precisely those containing the redundant copies of my backups. :-)
Not every body learns from other people disasters ;-) Which reminds me that I want to buy a sata hd tray and a pair of hd, to plug in and do backups. - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGGXVkACgkQtTMYHG2NR9VSKgCcDitK8V5NhMVPvVzHlQipofNT FNoAnAzUr9KWcRhec3g/7Xf2BH1wgJhs =0AKl -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Anton Aylward
-
Carl Hartung
-
Carlos E. R.
-
ellanios82