[arch-general] Full system backup with rsync
hi everyone i am trying to replace my laptop drive with another, to clone the laptop drive to a second drive i followed 'Full system backup with rsync' from the wiki 1 create a partition table and filesystem on the second drive 2 mount the drive to /mnt 3 rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt before i swap the drive in the laptop with the second drive do i chroot and run the following commands to configure the bootloader and do i need to do this from installation cd ? # grub-install --target=i386-pc /dev/sdx # grub-mkconfig -o /boot/grub/grub.cfg shadrock
On Mon, 17 Oct 2016 19:29:13 +0100, niya levi via arch-general wrote:
hi everyone
i am trying to replace my laptop drive with another,
to clone the laptop drive to a second drive i followed 'Full system backup with rsync' from the wiki
1 create a partition table and filesystem on the second drive
2 mount the drive to /mnt
3 rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt
I would simply sudo cp -r everything.
before i swap the drive in the laptop with the second drive
do i chroot and run the following commands to configure the bootloader and do i need to do this from installation cd ?
# grub-install --target=i386-pc /dev/sdx # grub-mkconfig -o /boot/grub/grub.cfg
you could simply sudo systemd-nspawn -bqD /mnt/ from the existing install and run the commands required for your bootloader of choice, assuming this grub auto thingy does generate UUID based entries and your fstab (if you still should use fstab at all) does contain those, too, since sdx would change from x=b to x=a, if you remove the old drive. Regards, Ralf -- Death of ROXTerm https://sourceforge.net/p/roxterm/discussion/422638/thread/60da6975/
On Mon, 17 Oct 2016 21:11:23 +0200, Ralf Mardorf wrote:
you could simply
sudo systemd-nspawn -bqD /mnt/
from the existing install and run the commands required for your bootloader of choice, assuming this grub auto thingy does generate UUID based entries and your fstab (if you still should use fstab at all) does contain those, too, since sdx would change from x=b to x=a, if you remove the old drive.
PPS: Oops again, this would add entries for the new and old drive's ;), so after removing the old drive, you need to run the grub auto-thingy again, to get rid of the entries related to the old drive.
Begin forwarded message: Date: Mon, 17 Oct 2016 21:12:51 +0200 From: Ralf Mardorf <ralf.mardorf@rocketmail.com> To: Arch general <arch-general@archlinux.org> Subject: Re: [arch-general] Full system backup with rsync On Mon, 17 Oct 2016 21:11:23 +0200, Ralf Mardorf wrote:
I would simply sudo cp -r everything.
Oops, sudo cp -pr
On Mon, 17 Oct 2016 21:20:53 +0200 Ralf Mardorf <silver.bullet@zoho.com> wrote:
Begin forwarded message:
Date: Mon, 17 Oct 2016 21:12:51 +0200 From: Ralf Mardorf <ralf.mardorf@rocketmail.com> To: Arch general <arch-general@archlinux.org> Subject: Re: [arch-general] Full system backup with rsync
On Mon, 17 Oct 2016 21:11:23 +0200, Ralf Mardorf wrote:
I would simply sudo cp -r everything.
Oops, sudo cp -pr
I would definitely go for rsync, because it's easier to resume if the process gets interrupted, for whatever reason. Also cp -pr does not preserve links or xattrs for example. Maybe cp -ar would be more appropriate. rsync -a is a good start, you might also want to check if you need -xattrs -hard-links -acls --numeric-ids (if doing edits from a live system) --sparse --relative And yes, you sould review your fstab. If you use UUIDs in it, then they have to be adapted of course. If you are willing to spend some time reading, here is a good article which mentions some pitfalls regarding backups. Regarding the bootloader: Yes, you would have to install it on the new drive ofc. Your commands seem okay to me, not sure if you need something more. If you have a swap file, create it first, so that it gets not scattered on the new drive. Regards, mearon -- Merlin Büge <toni@bluenox07.de>
Typo fix:
-xattrs -hard-links -acls
Should be of course: --xattrs --hard-links --acls Regards, mearon -- Merlin Büge <toni@bluenox07.de>
Sorry for the spam.
If you are willing to spend some time reading, here is a good article which mentions some pitfalls regarding backups.
Here is it: http://www.halfgaar.net/backing-up-unix Should go to bed now... Regards, mearon Merlin Büge <toni@bluenox07.de>
On Mon, 17 Oct 2016 21:51:20 +0200, Merlin Büge wrote:
Here is it: http://www.halfgaar.net/backing-up-unix
On Mon, 17 Oct 2016 21:42:03 +0200, Merlin Büge wrote:
Also cp -pr does not preserve links or xattrs for example. Maybe cp -ar would be more appropriate.
Ok, actually I regularly backup to a tar archive and at least links are preserved. I seemingly missed to use the --xattrs switch, fortunately this never caused an issue for me, but I consider to add it to my scripts soon. Thank you for the pointer and my apologies for the false advice. Regards, Ralf
On Mon, 17 Oct 2016 22:24:39 +0200, Ralf Mardorf wrote:
On Mon, 17 Oct 2016 21:42:03 +0200, Merlin Büge wrote:
Also cp -pr does not preserve links or xattrs for example. Maybe cp -ar would be more appropriate.
Ok, actually I regularly backup to a tar archive and at least links are preserved. I seemingly missed to use the --xattrs switch, fortunately this never caused an issue for me, but I consider to add it to my scripts soon.
Thank you for the pointer and my apologies for the false advice.
[rocketmouse@archlinux ~]$ cd /tmp/ [rocketmouse@archlinux tmp]$ mkdir test [rocketmouse@archlinux tmp]$ cd test/ [rocketmouse@archlinux test]$ touch 1.txt [rocketmouse@archlinux test]$ ln -s 1.txt link.txt [rocketmouse@archlinux test]$ ls 1.txt link.txt [rocketmouse@archlinux test]$ cd .. [rocketmouse@archlinux tmp]$ cp -pr test/ test_2 [rocketmouse@archlinux tmp]$ ls test_2/ 1.txt link.txt [rocketmouse@archlinux tmp]$ ls -l test test_2 test: total 0 -rw-r--r-- 1 rocketmouse rocketmouse 0 Oct 17 22:26 1.txt lrwxrwxrwx 1 rocketmouse rocketmouse 5 Oct 17 22:26 link.txt -> 1.txt test_2: total 0 -rw-r--r-- 1 rocketmouse rocketmouse 0 Oct 17 22:26 1.txt lrwxrwxrwx 1 rocketmouse rocketmouse 5 Oct 17 22:26 link.txt -> 1.txt [rocketmouse@archlinux tmp]$ cd test [rocketmouse@archlinux test]$ ln 1.txt hardlink.txt [rocketmouse@archlinux test]$ ls -l total 0 -rw-r--r-- 2 rocketmouse rocketmouse 0 Oct 17 22:26 1.txt -rw-r--r-- 2 rocketmouse rocketmouse 0 Oct 17 22:26 hardlink.txt lrwxrwxrwx 1 rocketmouse rocketmouse 5 Oct 17 22:26 link.txt -> 1.txt [rocketmouse@archlinux test]$ cd .. [rocketmouse@archlinux tmp]$ cp -pr test/ test_2 [rocketmouse@archlinux tmp]$ ls -l test test_2 test: total 0 -rw-r--r-- 2 rocketmouse rocketmouse 0 Oct 17 22:26 1.txt -rw-r--r-- 2 rocketmouse rocketmouse 0 Oct 17 22:26 hardlink.txt lrwxrwxrwx 1 rocketmouse rocketmouse 5 Oct 17 22:26 link.txt -> 1.txt test_2: total 0 -rw-r--r-- 1 rocketmouse rocketmouse 0 Oct 17 22:26 1.txt lrwxrwxrwx 1 rocketmouse rocketmouse 5 Oct 17 22:26 link.txt -> 1.txt drwxr-xr-x 2 rocketmouse rocketmouse 100 Oct 17 22:29 test [rocketmouse@archlinux tmp]$ -- Death of ROXTerm https://sourceforge.net/p/roxterm/discussion/422638/thread/60da6975/
Ok, hard links aren't links anymore. [rocketmouse@archlinux ~]$ cd /tmp/ [rocketmouse@archlinux tmp]$ mkdir test [rocketmouse@archlinux tmp]$ echo hello > test/test.txt [rocketmouse@archlinux tmp]$ ln test/test.txt test/hardlink.txt [rocketmouse@archlinux tmp]$ ls -i test/ 2906732 hardlink.txt 2906732 test.txt [rocketmouse@archlinux tmp]$ cp -pr test/ test_2 [rocketmouse@archlinux tmp]$ ls -i test_2/ 2908188 hardlink.txt 2908189 test.txt ^^ ^^ [rocketmouse@archlinux tmp]$ cat test_2/* hello hello
On Mon, 17 Oct 2016 21:11:23 +0200, Ralf Mardorf wrote:
you could simply
sudo systemd-nspawn -bqD /mnt/
from the existing install and run the commands required for your bootloader of choice, assuming this grub auto thingy does generate UUID based entries and your fstab (if you still should use fstab at all) does contain those, too, since sdx would change from x=b to x=a, if you remove the old drive.
Did I misunderstand something? Sure, if not both drives should be connected, you need a live media to install grub. My apologies.
participants (3)
-
Merlin Büge
-
niya levi
-
Ralf Mardorf