meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:fs:btrfs:send [2024/11/20 17:01] niziaklinux: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=/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 ===== ===== migrate to new storage =====
Line 87: Line 100:
   *       --whole-file, -W         copy files whole (w/o delta-xfer algorithm)   *       --whole-file, -W         copy files whole (w/o delta-xfer algorithm)
  
 +<file ini /etc/rsyncd.conf>
 +[rootfs]
 +        path = /target/@rootfs
 +</file>
 +rsync -v --daemon
  
-rsync -avxHAXPW --numeric-ids /target/@rootfs/+on client, list rsync modules:
  
 +rsync 192.168.177.161::
 +rootfs         
  
-rsync -arAXHvW --exclude=".snapshots" /oldroot/ /rpool/ 
-$ rsync -vuar host1:/var/www host2:/var/www 
  
-Sender:+Now rsync but do not limit to one filesystem, to copy all subvolumes into its places (already created on dst): 
 <code bash> <code bash>
 +rsync -avHAXPW --exclude=".snapshots" 192.168.177.161::rootfs /target/@rootfs
 +</code>
  
-btrfs send /target/@rootfs | zstd --fast -T0 | pv | nc -w 2 -N 192.168.177.171 44444+Try ssh to correct permission errors 
 +<code bash> 
 +rsync -avHAXPW --exclude=".snapshots" ssh://user@192.168.177.161/target/@rootfs/ /target/@rootfs 
 +</code> 
 + 
 +No need to add on not live FS: 
 +<code> 
 +--exclude='/dev' --exclude='/proc' --exclude='/sys' 
 +</code> 
 + 
 +Even if rsync daemon is started from root account (on src host) it cannot read some files according to normal permissions: 
 +<code> 
 +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) 
 +</code> 
 + 
 +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=".snapshots" /target/@rootfs 192.168.177.171::rootfs  
 +</code> 
 + 
 + 
 +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: 
 +<code bash> 
 +#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
 </code> </code>
  
 Receiver: Receiver:
 <code bash> <code bash>
-nc -vl 44444 | zstd -d | pv | btrfs receive /target+#nc 192.168.1.4 3333 | pv -b | tar --acls --xattrs -xzpsf - 
 + 
 +cd /target/@rootfs 
 +nc -vl 44444 | zstd -d | pv | tar -xpsf - 
 </code> </code>