I used ext4 but I switched to btrfs now (unfortunately).
As a backup I used clone script with rsync. It was fine for me because I could backup to even smaller partition.
The script is:
sudo -i
mkdir -p /mnt/{root1,root}
mount /dev/sdc1 /mnt/root/ # source
mount /dev/sdb1 /mnt/root1/ # target
rsync -axHAWXS --numeric-ids --info=progress2 /mnt/root/ /mnt/root1/
mount -o bind /dev/ /mnt/root1/dev/
mount -o bind /dev/pts/ /mnt/root1/dev/pts/
mount -o bind /sys/ /mnt/root1/sys/
mount -o bind /proc/ /mnt/root1/proc/
chroot /mnt/root1/
grub-install /dev/sdb --boot-directory=/boot/ --target=i386-pc
update-grub
after that the /etc/fstab was edited manualy.
now this script creates just top empty subfolders (starting with @) and nothing more. Just few kB
I think I donāt understand btrfs to much but anyway what is wrong with rsync on btrfs ?
Hi @mariush444 ,
Disclaimer:
I donāt use or know anything about btrfs. This is based purely on what I saw and read on the forums.
Is there a reason you donāt rather use timeshift?
System restore tool for Linux. Creates filesystem snapshots using rsync+hardlinks, or BTRFS snapshots. Supports scheduled snapshots, multiple backup levels, and exclude filters. Snapshots can be re...
Apparently itās good for use with BTRFS.
Rsync
is not the best fit tool for Btrfs. Better use btrfs send
.
You find good Information about Btrfs in the wiki
Btrfs snapshots take up significantly less disk space than rsync, even when transferred to external storage with send !
It is easy to use btrfs with its send/receive to backup one snapshot to an external drive. But it is real work, if you want do do this for several snapshots repeatedly. Even when you want to make these snapshots differential. ā¦
I did program this for my own backup, but it may be useful for others.
[HowTo] Backup btrfs snapshots with send/receive
Goals:
Simply a backup of a complete system (only the snapshots)
Back up all snapshots
Differential backup of each snapshot (fast)
Use as little ā¦
I have 1600 (!) snapshots of 5 pcs on 1 external disk with 2TB (<50%full)
(Try to do this with rsync without using backuppc
)
And every snapshot is mountable
Generally I donāt want/need snapshots/backup and additional tool like timeshift just to copy files. I like to use simplest tool as possible.
In this case I just want to make clone of my disk and I donāt understand why rsync doesnāt work .
PS
thank you for link.
so I have to use java and btrfs tools just to copy files.
Good tool, thank you for link but Iām looking for something simple.
I understand that rsync is not the best because of performance and volume but the question is why rsync doesnāt work at all ?
Zesko
14 February 2023 16:32
6
Can you show us what error message from rsync?
There is no error. rsync just copy ānothingā
rsync -axHAWXS --numeric-ids --info=progress2 /mnt/root/ /mnt/root1/
796 96% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/17)
source
target
But I think I made mistake and asked wrong question.
I start live manjaro from pendrive and just want to clone
/dev/sda1 to /dev/sdb2 (both btrfs).
So no java, no additional tools.
rsync or btrfs command or any other after existing in just started simple linux.
After that I want to start my system from /dev/sdb2
Zesko
14 February 2023 17:41
8
I see, but I do not think rsync
supports copying Btrfs subvolumes.
If you want to copy btrfs subvolumes from one Btrfs partition to another Btrfs partition, use official btrfs send
and btrfs receive
.
Note:
After copying, you have to change UUID of the partition in fstab and GRUB config.
Be careful what you ask:
Clone:
Copy an entire partition or disk (or a snapshot) with everything in it (no exceptions!), including empty space. Donāt resize! (dd, gparted ā¦ partition-tools)
Copy:
Copy files, permissions, directoriesā¦ (selection with regular expressions and exceptions). Empty space is omitted, no fixed size. (rsync, copy, mc ā¦ file- tools)
Backup:
Difficulty: ā
ā
āāā
If you follow the tutorial completely, you will be able to create a backup of your entire system not only limited to Manjaro, but also including Windows, RHEL, Ubuntu, ā¦ and whatever else you might have installed on your system!
Even if you replace your HDD by an SSD, your HDD crashes, your entire system gets stolen, ā¦ you can always restore a Cold System backup to an identical system (You cannot restore E.G. a Dell XPS onto a Dell PowerEdge and then expect that toā¦
There is no tool that fits all
1 Like
Thanks a lot. It was very help full link.
The solution for my case is (not optimized yet but)
sudo -i
mkdir -p /mnt/{root1,root}
mount /dev/sdc1 /mnt/root/ # source
mount /dev/sdb1 /mnt/root1/ # target
btrfs subvolume snapshot -r /mnt/root/@home /mnt/root/folder_0
btrfs send /mnt/root/folder_0 | btrfs receive /mnt/root1
btrfs subvolume snapshot /mnt/root1/folder_0 /mnt/root1/@home
btrfs subvolume delete /mnt/root1/folder_0
btrfs subvolume delete /mnt/root/folder_0
btrfs subvolume snapshot -r /mnt/root/@ /mnt/root/folder_0
btrfs send /mnt/root/folder_0 | btrfs receive /mnt/root1
btrfs subvolume snapshot /mnt/root1/folder_0 /mnt/root1/@
btrfs subvolume delete /mnt/root1/folder_0
btrfs subvolume delete /mnt/root/folder_0
btrfs subvolume snapshot -r /mnt/root/@cache /mnt/root/folder_0
btrfs send /mnt/root/folder_0 | btrfs receive /mnt/root1
btrfs subvolume snapshot /mnt/root1/folder_0 /mnt/root1/@cache
btrfs subvolume delete /mnt/root1/folder_0
btrfs subvolume delete /mnt/root/folder_0
btrfs subvolume snapshot -r /mnt/root/@log /mnt/root/folder_0
btrfs send /mnt/root/folder_0 | btrfs receive /mnt/root1
btrfs subvolume snapshot /mnt/root1/folder_0 /mnt/root1/@log
btrfs subvolume delete /mnt/root1/folder_0
btrfs subvolume delete /mnt/root/folder_0
mount -o bind /dev/ /mnt/root1/@/dev/
mount -o bind /dev/pts/ /mnt/root1/@/dev/pts/
mount -o bind /sys/ /mnt/root1/@/sys/
mount -o bind /proc/ /mnt/root1/@/proc/
chroot /mnt/root1/
mount /dev/sdb1 # again but in chroot
grub-install /dev/sdb --boot-directory=/boot/ --target=i386-pc
update-grub
blkid # to know part id
nano /etc/fstab # to modify id
reboot
probably @cache and @log is not needed but I have to make more tests.
Thanks a lot @Zesko
system
Closed
17 February 2023 12:36
11
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.