meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:fs:btrfs:send [2024/11/20 16:19] – niziak | linux:fs:btrfs:send [2024/11/21 17:32] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== send / receive ====== | ====== send / receive ====== | ||
| + | |||
| + | grub-install --target=x86_64-efi --efi-directory=/ | ||
| + | update-grub | ||
| + | |||
| + | mount --rbind /dev / | ||
| + | mount --rbind /proc / | ||
| + | mount --rbind /sys / | ||
| + | chroot / | ||
| + | |||
| + | grub-install --target=x86_64-efi --efi-directory=/ | ||
| + | Installing for x86_64-efi platform. | ||
| + | grub-install: | ||
| + | |||
| ===== migrate to new storage ===== | ===== migrate to new storage ===== | ||
| Line 32: | Line 45: | ||
| mkdir /target | mkdir /target | ||
| mount / | mount / | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt install netcat-openbsd pv zstd | ||
| + | </ | ||
| + | |||
| + | ==== rsync ==== | ||
| + | |||
| + | Rsync send is not related to BTRFS, but here it can help if FS is '' | ||
| + | |||
| + | Recreate destination volumes | ||
| + | |||
| + | <code bash> | ||
| cd /target | cd /target | ||
| btrfs sub create @rootfs | btrfs sub create @rootfs | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/var | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/opt | ||
| + | btrfs sub create @rootfs/usr | ||
| + | btrfs sub create @rootfs/ | ||
| + | |||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| + | btrfs sub create @rootfs/ | ||
| </ | </ | ||
| + | Rsync option explanation: | ||
| + | * '' | ||
| + | * --recursive, | ||
| + | * --links, -l | ||
| + | When symlinks are encountered, | ||
| + | tination. | ||
| + | * | ||
| + | * --times, -t preserve modification times | ||
| + | * --group, -g preserve group | ||
| + | * --owner, -o preserve owner (super-user only) | ||
| + | * -D same as --devices --specials | ||
| + | * --devices | ||
| + | * --specials | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * --numeric-ids | ||
| + | * | ||
| + | |||
| + | <file ini / | ||
| + | [rootfs] | ||
| + | path = / | ||
| + | </ | ||
| + | rsync -v --daemon | ||
| + | |||
| + | on client, list rsync modules: | ||
| + | |||
| + | rsync 192.168.177.161:: | ||
| + | rootfs | ||
| + | |||
| + | |||
| + | Now rsync but do not limit to one filesystem, to copy all subvolumes into its places (already created on dst): | ||
| <code bash> | <code bash> | ||
| - | sudo apt install netcat-openbsd pv zstd | + | rsync -avHAXPW --exclude=" |
| </ | </ | ||
| + | |||
| + | Try ssh to correct permission errors | ||
| + | <code bash> | ||
| + | rsync -avHAXPW --exclude=" | ||
| + | </ | ||
| + | |||
| + | No need to add on not live FS: | ||
| + | < | ||
| + | --exclude='/ | ||
| + | </ | ||
| + | |||
| + | Even if rsync daemon is started from root account (on src host) it cannot read some files according to normal permissions: | ||
| + | < | ||
| + | rsync: [sender] send_files failed to open "/ | ||
| + | rsync: [sender] send_files failed to open "/ | ||
| + | rsync: [sender] send_files failed to open "/ | ||
| + | </ | ||
| + | |||
| + | workaround is to start rsync daemon on dst host with the same rsyncd.conf config and start rsync from src host: | ||
| + | |||
| + | <code bash> | ||
| + | rsync -avxHAXPW --exclude=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | tar: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | | ||
| + | |||
| + | Sender: | ||
| + | <code bash> | ||
| + | #tar -czpsf - / | ||
| + | cd / | ||
| + | tar --acls --xattrs -cpsf - . | zstd --fast -T0 | pv | nc -w 2 -N 192.168.177.171 44444 | ||
| + | </ | ||
| + | |||
| + | Receiver: | ||
| + | <code bash> | ||
| + | #nc 192.168.1.4 3333 | pv -b | tar --acls --xattrs -xzpsf - | ||
| + | |||
| + | cd / | ||
| + | nc -vl 44444 | zstd -d | pv | tar -xpsf - | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== btrfs send ==== | ||
| + | |||
| + | It can send only '' | ||
| + | Only possible to send '' | ||
| Sender: | Sender: | ||