Finally learned how to use rsync

Here you can discuss every aspect of Debian. Note: not for support requests!

Finally learned how to use rsync

Postby ticojohn » 2018-04-13 22:07

After years of using Grsync to backup just /home, I decided it was time to learn how to use rsync. The main motivation was that I am thinking about upgrading Jessie (i386) to Stretch, and I thought it would be a good time to make a working backup of Jessie. After a bunch of on line searching, and a few missteps, I was finally able to rsync Jessie to an empty partition on my hard drive (Jessie is on a SSD). After changing the entries in fstab, and then updating grub, I now have a working duplicate of Jessie. rsync is COOL!
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby sunrat » 2018-04-14 00:09

Yeah it's pretty straightforward once you work out how trailing slashes behave. ;)
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2429
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Finally learned how to use rsync

Postby p.H » 2018-04-14 08:42

Did you check that the new partition is actually mounted as / ?

In, my experience, updating fstab on the backup system and running update-grub on the original system is not enough and results in the new menu entry mounting the original partition as / ; you need to run update-grub from the backup system (in chroot) before doing it on the original system.
p.H
 
Posts: 523
Joined: 2017-09-17 07:12

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 13:21

sunrat wrote:Yeah it's pretty straightforward once you work out how trailing slashes behave. ;)

Yep! That caused a few missteps but I finally got there.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 13:33

p.H wrote:Did you check that the new partition is actually mounted as / ?

I am still pretty much a noob when it comes to Linux, even though I have been using it for about 7 years, so I'm not sure I understand the question nor how to verify that the partition is mounted as /. I am able to select and load the new partition (sdb1). When I open pcmanfm and look at the file system the top level appears to be /. I will do some further checking but everything is functioning as desired.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 13:47

p.H wrote:Did you check that the new partition is actually mounted as / ?


OOOPPPS ! It appears that it is NOT working as expected. When I select the new partition (sdb1) in the grub menu, it is actually booting the original partition (sda1). So what do I need to do?
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby p.H » 2018-04-14 13:58

As I wrote in my previous message:
- mount and chroot the new partition with /dev/, /sys and /proc
- run update-grub
- exit the chroot and unmount the above
- run update-grub

Or you can edit /boot/grub/grub.cfg on both partitions and replace the UUID of the original partition with the one of the new partition in the root= options of the menu entries for the system on the new partition.
p.H
 
Posts: 523
Joined: 2017-09-17 07:12

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 14:18

p.H wrote:As I wrote in my previous message:
- mount and chroot the new partition with /dev/, /sys and /proc
- run update-grub
- exit the chroot and unmount the above
- run update-grub

Or you can edit /boot/grub/grub.cfg on both partitions and replace the UUID of the original partition with the one of the new partition in the root= options of the menu entries for the system on the new partition.

Okay. Not sure editing the /boot/grub/grub.cfg files is a good idea. WOuldn't it get changed when I do update-grub? And my brain is not getting it with your instructions. I will do some research, unless you want to give me detailed instructions. Thanks for the help.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby Head_on_a_Stick » 2018-04-14 14:33

ticojohn wrote:my brain is not getting it

The stretch release notes have a nice section about recovery:

https://www.debian.org/releases/stretch ... 07.html.en
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 14:39

Head_on_a_Stick wrote:
ticojohn wrote:my brain is not getting it

The stretch release notes have a nice section about recovery:

https://www.debian.org/releases/stretch ... 07.html.en

Thanks HOAS. What's the worst that can happen? :shock:
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 15:15

HOAS, if you're there, I do not see a menu option for 'rescue'. I see a recovery mode, but not 'rescue'. Am I being stupid?
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby Head_on_a_Stick » 2018-04-14 15:35

There's an entry on the Debian ISO image GRUB menu, I think.

If not, we've recently added that option to the BunsenLabs Helium-dev ISO image so you could use that:

https://mirror.vinzv.space/bunsenlabs/helium/beta/
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-14 15:45

Okay. I followed the advice from p.H and edited the /boot/grub/grub.cfg on both sda1 and sdb1. After verifying that I could boot as desired I then did update-grub on both sda1 and sdb1. Everything now appears to be working as desired. I know that this probably was NOT the best practice but it got the results I wanted.

Thanks to HOAS and p.H for their help and advice.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica

Re: Finally learned how to use rsync

Postby p.H » 2018-04-15 08:12

ticojohn wrote:It appears that it is NOT working as expected.

It was just working as I expected, not as you expected.
Sorry for bringing bad news and extra work.

A bit of explaination :

When update-grub/grub-mkconfig detects another Linux installation and builds a menu entry for it, it looks for a grub.cfg file in this installation. If it finds the file, it copies the kernel command line parameters, in the menu entry, including the root= parameter instead of using the actual root location. I guess this is a rather unknow feature of update-grub.

Since the "other" system is a backup copy of the original system, its grub.cfg file contains root= with the UUID of the original root partition. So, even though GRUB loads the kernel and initramfs from the backup partition, they mount the orginal partition as root.

Running update-grub from the backup system would update its grub.cfg with the backup partition UUID. Then running update-grub from the original system would update its grub.cfg with the UUID present in the grub.cfg on the backup partition.
Last edited by p.H on 2018-04-15 12:42, edited 3 times in total.
p.H
 
Posts: 523
Joined: 2017-09-17 07:12

Re: Finally learned how to use rsync

Postby ticojohn » 2018-04-15 12:21

p.H wrote:
ticojohn wrote:It appears that it is NOT working as expected.

It was just working as I expected, not as you expected.
Sorry for bringing bad news and extra work.

A bit of explaination :

When update-grub/grub-mkconfig detects another Linux installation into the GRUB menu and builds a menu entry for it, it looks for a grub.cfg file in this installation. If it finds the file, it copies the kernel command line parameters, including the root= parameter. I guess this is a rather unknow feature of update-grub.

Since the "other" system is a backup copy of the original system, its grub.cfg file contains root= with the UUID of the original root partition. So, even though GRUB loads the kernel and initramfs from the backup partition, they mount the orginal partition as root.

Running update-grub from the backup system would update its grub.cfg with the backup partition UUID. Then running update-grub from the original system would update its grub.cfg with the UUID present in the grub.cfg on the backup partition.

Thanks for that explanation. It makes things a lot more clear to me. Good to know info. Thanks a lot. Eventually I may get around to learning how to use chroot. Probably come in handy.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 801
Joined: 2009-08-29 18:10
Location: Costa Rica


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable