Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Finally learned how to use rsync

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Finally learned how to use rsync

#1 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Finally learned how to use rsync

#2 Post by sunrat »

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!

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Finally learned how to use rsync

#3 Post by p.H »

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.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#4 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#5 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#6 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Finally learned how to use rsync

#7 Post by p.H »

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.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#8 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Finally learned how to use rsync

#9 Post by Head_on_a_Stick »

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
deadbang

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#10 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#11 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Finally learned how to use rsync

#12 Post by Head_on_a_Stick »

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/
deadbang

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#13 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Finally learned how to use rsync

#14 Post by p.H »

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.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Finally learned how to use rsync

#15 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

Post Reply