When comparing the disk usage for a mounted harddrive the usage is completely different when compared between the host and the container. I am running Ubuntu 14.04 on the host and in the lxc container.
The hard drive is mounted on the host as confirmed by
/etc/mtab which has the following entry:
/dev/nvme0n1 /mnt/SSD ext4 rw 0 0. The drive however is not mounted using
The drive is mounted inside the lxc container using fstab settings in:
From the host:
# du -hs /mnt/SSD/ 20K /mnt/SSD/ # df -h Filesystem Size Used Avail Use% Mounted on udev 63G 4.0K 63G 1% /dev tmpfs 13G 1.4M 13G 1% /run /dev/mapper/sifr--vg-root 314G 241G 58G 81% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 63G 0 63G 0% /run/shm none 100M 0 100M 0% /run/user /dev/sda1 236M 100M 124M 45% /boot /dev/nvme0n1 1.1T 71M 1.1T 1% /mnt/SSD
From the container
$ du -hs /mnt/SSD/ 16G /mnt/SSD/ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/sifr--vg-root 314G 241G 58G 81% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 13G 136K 13G 1% /run none 5.0M 0 5.0M 0% /run/lock none 63G 4.0K 63G 1% /run/shm none 100M 0 100M 0% /run/user
- How and why does the same drive shows two different usages?
- Which is the correct usage?
After unmounting the drive using
sudo umount /dev/nvme0n1, I now see 16GB disk usage in the host and the container:
$ du -hs /mnt/SSD/ 16G /mnt/SSD/
I mounted another drive
/etc/fstab and gave the container access to it using the same method:
/var/lib/lxc/container_name/fstab. The second drive's usage is also consistent and the contents are available in both the container and the host.
The differences between the two drives are that
/dev/nvme0n1 is a nvme drive which was mounted manually, whereas
/dev/sdb is a magnetic drive and was mounted using
What could be causing the difference in the behaviour and how to make
/dev/nvme0n1 available in the container?