Then run this script which copies a 4MB binary to a btrfs filesystem, tars the directory up containing the binary; then untars to stdout and md5sum compares, showing it's different.
This has been reported to both gnu-tar and linux-btrfs; I'm not aware of an actual fix.
Note that Xenial 4.4 kernels do not exhibit this behavior, and Bionic 4.15 kernel appears to be fixed as well though I'm not sure what the difference is.
root@ubuntu:~# lsb_release -rd virtual: archive. ubuntu. com/ubuntu artful-updates/main amd64 Packages security. ubuntu. com/ubuntu artful- security/ main amd64 Packages dpkg/status archive. ubuntu. com/ubuntu artful/main amd64 Packages
Description: Ubuntu 17.10
Release: 17.10
root@ubuntu:~# apt-cache policy linux-image-virtual
linux-image-
Installed: 4.13.0.37.40
Candidate: 4.13.0.37.40
Version table:
*** 4.13.0.37.40 500
500 http://
500 http://
100 /var/lib/
4.13.0.16.17 500
500 http://
3. Taring files into an archive are not truncated
4. Files included in tar are filled with NULLs
To reproduce, run an Artful system with one spare disk:
- mkfs.btrfs -f /dev/sda space_cache, subvolid= 5,subvol= / 0 0
- mount /dev/sda /mnt
- grep sda /proc/mounts
/dev/sda /mnt btrfs rw,relatime,
Then run this script which copies a 4MB binary to a btrfs filesystem, tars the directory up containing the binary; then untars to stdout and md5sum compares, showing it's different.
% SPARSE="-S"; rm -rf /mnt/tmp; md5sum /usr/bin/python3.6; mkdir -p /mnt/tmp; cp -a /usr/bin/python3.6 /mnt/tmp; tar -C /mnt/tmp $SPARSE -czf /mnt/test.tgz .; tar $SPARSE -xzf /mnt/test.tgz -O | md5sum 364bfa1aaa82371 a3 /usr/bin/python3.6 926273853defcb1 2a -
e4121d2f3126b8c
0ce8c4139740198
And now without the sparse flag:
# SPARSE=""; rm -rf /mnt/tmp; md5sum /usr/bin/python3.6; mkdir -p /mnt/tmp; cp -a /usr/bin/python3.6 /mnt/tmp; tar -C /mnt/tmp $SPARSE -czf /mnt/test.tgz .; tar $SPARSE -xzf /mnt/test.tgz -O | md5sum 364bfa1aaa82371 a3 /usr/bin/python3.6 364bfa1aaa82371 a3 -
e4121d2f3126b8c
e4121d2f3126b8c
This has been reported to both gnu-tar and linux-btrfs; I'm not aware of an actual fix.
Note that Xenial 4.4 kernels do not exhibit this behavior, and Bionic 4.15 kernel appears to be fixed as well though I'm not sure what the difference is.
References:
https:/ /patchwork. kernel. org/patch/ 10151037/ /www.spinics. net/lists/ linux-btrfs/ msg56768. html /www.spinics. net/lists/ linux-btrfs/ msg57111. html
https:/
https:/
ProblemType: Bug ature: Ubuntu 4.13.0- 37.42-generic 4.13.13
DistroRelease: Ubuntu 17.10
Package: linux-image-virtual 4.13.0.37.40
ProcVersionSign
Uname: Linux 4.13.0-37-generic x86_64
AlsaDevices:
total 0
crw-rw---- 1 root audio 116, 1 Mar 21 22:55 seq
crw-rw---- 1 root audio 116, 33 Mar 21 22:55 timer
AplayDevices: Error: [Errno 2] No such file or directory: 'aplay': 'aplay'
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord': 'arecord'
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: N/A
Date: Wed Mar 21 23:08:05 2018
IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig': 'iwconfig'
Lsusb: Error: command ['lsusb'] failed with exit code 1:
MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
PciMultimedia:
ProcEnviron: 256color
TERM=xterm-
PATH=(custom, no user)
LANG=C.UTF-8
SHELL=/bin/bash
ProcFB:
ProcKernelCmdLine: BOOT_IMAGE= /boot/vmlinuz- 4.13.0- 37-generic root=LABEL= cloudimg- rootfs ro console=tty1 console=ttyS0 ersions: restricted- modules- 4.13.0- 37-generic N/A backports- modules- 4.13.0- 37-generic N/A 1.8.2-1ubuntu1 version: pc-i440fx-xenial bvrUbuntu- 1.8.2-1ubuntu1: bd04/01/ 2014:svnQEMU: pnStandardPC( i440FX+ PIIX,1996) :pvrpc- i440fx- xenial: cvnQEMU: ct1:cvrpc- i440fx- xenial: version: pc-i440fx-xenial
RelatedPackageV
linux-
linux-
linux-firmware N/A
RfKill: Error: [Errno 2] No such file or directory: 'rfkill': 'rfkill'
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: Ubuntu-
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.
dmi.modalias: dmi:bvnSeaBIOS:
dmi.product.name: Standard PC (i440FX + PIIX, 1996)
dmi.product.
dmi.sys.vendor: QEMU