Different hosts, different container sizes


(Roman V. Isaev) #1

I have two hosts: one is Ubuntu 18.04 computer and another is remote CentOS 7 KVM (remote hosting). Both have lxd 3.10 installed via snap. Ubuntu storage is zfs and CentOS storage is btrfs.

Now I set up backup routine to backup CentOS containers to Ubuntu. Everything works well, containers are copied… then I found a very strange thing – the same container on Ubuntu takes less space than on CentOS!

CentOS:

 ns pts/1#lxc exec alp sh
~ # cd /
/ # du -hs
du: can't open './dev/.lxd-mounts': Permission denied
du: can't open './proc/tty/driver': Permission denied
du: can't open './sys/fs/fuse/connections/43': Permission denied
du: can't open './sys/kernel/debug': Permission denied
417.0M  .

Ubuntu 18.04:

dragon pts/20#lxc exec alp sh
~ # cd /
/ # du -hs
du: can't open './sys/kernel/debug': Permission denied
du: can't open './sys/fs/pstore': Permission denied
du: can't open './sys/fs/fuse/connections/87': Permission denied
du: can't open './dev/.lxd-mounts': Permission denied
du: can't open './proc/sys/fs/binfmt_misc': Permission denied
du: can't open './proc/tty/driver': Permission denied
236.6M  .

If I copy container from CentOS to Ubuntu and then copy it back, size changes back too – container turns “small” when copied to Ubuntu, then “small” size from Ubuntu turns “large” inside CentOS.

Why? I’d like to have extra space on my cramped CentOS KVM, but is that just an illusion? Some zfs magic to squash empty space? Or what?


(David Negreira) #2

Probably it is the compression of ZFS which is enabled by default


(Roman V. Isaev) #3

Yep, I installed zfs on CentOS KVM and got much more space for my containers. I think it should be mentioned in storage documentation: I chose btrfs at first because I did not want to install additional packages (to keep system upgradeable in the long run), but I did not know that zfs storage has compression built in and it worth addition hassle of messing with dkms.


(David Negreira) #4