meta data for this page
  •  

This is an old revision of the document!


send / receive

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 links
  • A –acls, -A preserve ACLs (implies –perms)
  • X –xattrs, -X preserve extended attributes
  • P -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)

rsync -avxHAXPW –numeric-ids /target/@rootfs/

rsync -arAXHvW –exclude=“.snapshots” /oldroot/ /rpool/ $ rsync -vuar host1:/var/www host2:/var/www

Sender:

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

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