Re: Btrfs send with parent different size depending on source of files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



14.02.2019 14:37, André Malm пишет:
> Hello,
> 
> I'm not sure this is the right forum to ask on but I'll try and if its
> not I do apologize. I have also created a stack overflow question
> without success (
> https://stackoverflow.com/questions/54634703/btrfs-send-with-parent-different-size-depending-on-source-of-files
> ) but ill paste the question here too. Thank you.
> 
> What i'm trying to achieve is sending only the diff of the parent with
> btrfs send -p
> 
> Running this will produce a file 'out' with size 639 bytes, i.e only
> diff sent.
> 
> ====================================================
> 
> btrfs subvolume create A
> btrfs subvolume create B
> mkdir A/dir
> 
> dd if=/dev/urandom of=A/dir/server.jar bs=1024 count=40K
> cp --reflink=always A/dir/server.jar B/server.jar
> 
> btrfs subvolume snapshot -r A a
> btrfs subvolume snapshot -r B b
> btrfs send -p a b > out
> 
> ====================================================
> 
> However if I change the dd command to wget like this:
> 
> ====================================================
> 
> btrfs subvolume create A
> btrfs subvolume create B
> mkdir A/dir
> 
> wget -O A/dir/server.jar
> https://launcher.mojang.com/v1/objects/20c069d373e77265aaeeedb733f7051e294325a3/server.jar
> 
> cp --reflink=always A/dir/server.jar B/server.jar
> 
> btrfs subvolume snapshot -r A a
> btrfs subvolume snapshot -r B b
> btrfs send -p a b > out
> 
> ====================================================
> 
> 
> The 'out' file is 34M, which is the full size.
> 
> What causes this?
> 
> 

File size of "real" server.jar is not exact multiple of btrfs block size
(4096) which causes the last extent to be "incomplete". btrfs won't
clone extent in this case. You can trivially reproduce it by using the
same size in the first case (although exact extent distribution may be
different of course, in the worst case you get single extent which is
sent in full):



dd if=/dev/urandom of=A/dir/server.jar bs=1024 count=34625



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux