Issuing a resize2fs from within a container fails

I have two containers

  • containerA : with ext4 filesystem mounted on /dev/sda from the host
mount /dev/sda /volumes/v1; 
docker run --name containerA -v /volumes/v1:/v1 ubuntu /bin/bash -c "sleep 3600"
  • containerB : with /dev/sda exposed using --device
docker run ---privileged --device /dev/sda ubuntu
  • I’m trying to resize the filesystem via containerB, but unable to do so due to an EBUSY error.
docker run --privileged=true --rm --name containerB --device /dev/sda ubuntu resize2fs /dev/sda
resize2fs 1.42.13 (17-May-2015)
resize2fs: Device or resource busy while trying to open /dev/sda
Couldn't find valid filesystem superblock.

Any suggestions on what is going wrong and if/how I can get the resize2fs to work?


the container doesn’t own the volume, so can’t resize it.