6

When I look at the output of lsblk it will usually show:

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk
├─sda1   8:1    0  1023M  0 part /boot
└─sda2   8:2    0 297.1G  0 part /
sr0     11:0    1  1024M  0 rom

with / being the mountpoint of my root filesystem. However, if I start sudo systemctl start docker I get the following output:

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk
├─sda1   8:1    0  1023M  0 part /boot
└─sda2   8:2    0 297.1G  0 part /var/lib/docker/btrfs
sr0     11:0    1  1024M  0 rom

and now the mountpoint of my root filesystem has according to lsblk changed to /var/lib/docker/btrfs. This raises three questions for me:

  1. Is this true?
  2. Is this in order or should this not be the case?
  3. Why?
6
  • 1. yes, 2. yes, 3. because that is docker's primary function
    – mikeserv
    Aug 21, 2014 at 18:40
  • As far as I can see the text you linked does not explain how and why docker changes the mountpoint of the filesystem. It is also ab bit dated given what has changed in the last time in how docker works. My own explanation is that docker uses the btrfs snapshot tool to store images and that it changes the mountpoint to the default place where it stores the snapshots/images; namely /var/lib/docker/btrfs. This can be verified by looking into the folder. I just wanted to make sure that I'm not totally off. Aug 21, 2014 at 18:49
  • 1
    it's because it docks the container to /. your explanation is right-on, though. they're one and the same. docker deals with container images - it's basically a chroot, but kernel implemented... or (because chroot is kernel implemented) a more complete chroot, maybe.
    – mikeserv
    Aug 21, 2014 at 18:51
  • 1
    Cheers @mikeserv! I was really puzzled for a moment by the output of lsblk. Aug 21, 2014 at 18:52
  • @mikeserv, as you were the first to answer my question/confirm my suspicion, do you want to post it as an answer so that I can accept it? (I hope this is ok @pqnet.) Aug 22, 2014 at 7:11

1 Answer 1

3

A partition can be mounted in multiple paths, but the lsblk will only show one. In your case /dev/sda2 contains a btrfs filesystem, which is mounted both as / and as /var/lib/docker/btrfs, probably with two different subvolumes. To see more details on how stuff are mounted around your system use cat /proc/mounts.

As for number 3, my guess is that docker uses btrfs subvolumes as storage for linux containers for running jailed daemons. This allows for easily creating snapshots of these containers.

1
  • Cheers @pqnet! Indeed, there are two subvolumes mounted at /dev/sda2; namely / and /var/lib/docker/btrfs. Aug 22, 2014 at 7:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .