meta data for this page
send / receive
grub-install –target=x86_64-efi –efi-directory=/target/@rootfs/boot/efi –boot-directory=/target/@rootfs/boot –bootloader-id=debian –recheck –no-floppy update-grub
mount –rbind /dev /target/@rootfs/dev mount –rbind /proc /target/@rootfs/proc mount –rbind /sys /target/@rootfs/sys chroot /target/@rootfs /bin/bash –login
grub-install –target=x86_64-efi –efi-directory=/boot/efi –bootloader-id=debian –recheck –no-floppy Installing for x86_64-efi platform. grub-install: error: cannot find a device for /boot/grub (is /dev mounted?).
migrate to new storage
Use Clonezilla live USB with latest 6.11 kernel.
There is a hole between Windows partitions and Windows recovery partitions:
parted /dev/nvme0n1 print free Number Start End Size File system Name Flags 17.4kB 1049kB 1031kB Free Space 1 1049kB 106MB 105MB fat32 EFI system partition boot, esp, no_automount 2 106MB 123MB 16.8MB Microsoft reserved partition msftres, no_automount 3 123MB 60.3GB 60.2GB ntfs Basic data partition msftdata 60.3GB 511GB 451GB Free Space 4 511GB 512GB 944MB ntfs Basic data partition hidden, diag, no_automount 512GB 512GB 335kB Free Space
So create 16GB swap at end and BTRFS for root part.
parted /dev/nvme0n1 mkpart swap sw 495G 511G mkpart root btrfs 60.3GB 495GB
mkfs.btrfs /dev/nvme0n1p6 mkdir /target mount /dev/nvme0n1p6 /target
sudo apt install netcat-openbsd pv zstd
rsync
Rsync send is not related to BTRFS, but here it can help if FS is ro
state due to errors.
Recreate destination volumes
cd /target btrfs sub create @rootfs btrfs sub create @rootfs/home btrfs sub create @rootfs/var btrfs sub create @rootfs/var/log btrfs sub create @rootfs/var/cache btrfs sub create @rootfs/var/spool btrfs sub create @rootfs/var/lib btrfs sub create @rootfs/var/lib/docker btrfs sub create @rootfs/var/snap btrfs sub create @rootfs/opt btrfs sub create @rootfs/usr btrfs sub create @rootfs/usr/local btrfs sub create @rootfs/home/user btrfs sub create @rootfs/home/user/prj btrfs sub create @rootfs/home/user/Documents
Rsync option explanation:
a
–archive, -a archive mode is -rlptgoD (no -A,-X,-U,-N,-H)- –recursive, -r recurse into directories
- –links, -l
When symlinks are encountered, recreate the symlink on the des‐
tination. * --perms, -p preserve permissions * --times, -t preserve modification times * --group, -g preserve group * --owner, -o preserve owner (super-user only) * -D same as --devices --specials * --devices preserve device files (super-user only) * --specials preserve special files * ''v'' --verbose, -v increase verbosity * ''x'' --one-file-system, -x don't cross filesystem boundaries
H
–hard-links, -H preserve hard linksA
–acls, -A preserve ACLs (implies –perms)X
–xattrs, -X preserve extended attributesP
-P same as –partial –progress- –numeric-ids don't map uid/gid values by user/group name
- –whole-file, -W copy files whole (w/o delta-xfer algorithm)
- /etc/rsyncd.conf
[rootfs] path = /target/@rootfs
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):
rsync -avHAXPW --exclude=".snapshots" 192.168.177.161::rootfs /target/@rootfs
Try ssh to correct permission errors
rsync -avHAXPW --exclude=".snapshots" ssh://user@192.168.177.161/target/@rootfs/ /target/@rootfs
No need to add on not live FS:
--exclude='/dev' --exclude='/proc' --exclude='/sys'
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 "/var/spool/postfix/pid/unix.local" (in rootfs): Permission denied (13) rsync: [sender] send_files failed to open "/var/spool/postfix/pid/unix.retry" (in rootfs): Permission denied (13) rsync: [sender] send_files failed to open "/var/spool/postfix/pid/unix.smtp" (in rootfs): Permission denied (13)
workaround is to start rsync daemon on dst host with the same rsyncd.conf config and start rsync from src host:
rsync -avxHAXPW --exclude=".snapshots" /target/@rootfs 192.168.177.171::rootfs
tar:
-c
create-p
,–preserve-permissions
,–same-permissions
extract information about file permissions (default for superuser)-s
,–preserve-order
,–same-order
Sort names to extract to match archive-f
,–file=ARCHIVE
Use archive file or device ARCHIVE. If this option is not given, tar will first examine the enviro
Sender:
#tar -czpsf - /target/@rootfs | pv -b | nc -l -p 44444 cd /target/@rootfs tar --acls --xattrs -cpsf - . | zstd --fast -T0 | pv | nc -w 2 -N 192.168.177.171 44444
Receiver:
#nc 192.168.1.4 3333 | pv -b | tar --acls --xattrs -xzpsf - cd /target/@rootfs nc -vl 44444 | zstd -d | pv | tar -xpsf -
btrfs send
It can send only ro
volumes. If FS is broken and forced ro
you cannot set volumes to ro
:)
Only possible to send ro
snapshots.
Sender:
btrfs property set -ts /target/@roots ro true btrfs send /target/@rootfs | zstd --fast -T0 | pv | nc -w 2 -N 192.168.177.171 44444
Receiver:
nc -vl 44444 | zstd -d | pv | btrfs receive /target