How to know if it is safe to remove block storage

September 18, 2017 1.4k views
Block Storage Docker Ubuntu 16.04

I have a block storage volume-nyc1-01 of 1TB attached to the droplet and we would like to remove it.

The volume has not been mounted yet (no entry in fstab or mtab) so I guess I can simply delete it from dashboard.

But df -h shows that size of docker volumes are more than 60GB (which is systems SSD).

root@ubuntu-4gb-nyc1-01:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 41M 355M 11% /run
/dev/vda1 59G 12G 47G 21% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/dm-1 100G 617M 100G 1% /var/lib/docker/devicemapper/mnt/37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10
shm 64M 0 64M 0% /var/lib/docker/containers/37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10/shm
--- truncated --
tmpfs 396M 0 396M 0% /run/user/0

I would like to know from where these space come from and if its safe to remove the block storage ?

Any help is appreciated.

3 comments
  • @syedhabeeb

    Check the output of mount if it is not mounted then you can safely remove it, but I have no idea about the disk space used by docker.

  • @Mohsen47 thanks, volume is not in mount -l too,
    disk space used by docker is what pulls me back from removing it.

  • lsblk says this, if it helps

    root@ubuntu-4gb-nyc1-01:~# lsblk
    NAME                                                                                     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda                                                                                        8:0    0 1000G  0 disk 
    vda                                                                                      253:0    0   60G  0 disk 
    └─vda1                                                                                   253:1    0   60G  0 part /
    loop0                                                                                      7:0    0  100G  0 loop 
    └─docker-253:1-516365-pool                                                               252:0    0  100G  0 dm   
      ├─docker-253:1-516365-37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10 252:1    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10
      ├─docker-253:1-516365-68daacf086ac074f8f0a21465c05d966ff22735fdf02120b380ac993d280683a 252:2    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/68daacf086ac074f8f0a21465c05d966ff22735fdf02120b380ac993d280683a
      ├─docker-253:1-516365-6b2d1832f9ed653b8a1e67687ac54a19297c32a94a909f7c6d94fe9953194332 252:3    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/6b2d1832f9ed653b8a1e67687ac54a19297c32a94a909f7c6d94fe9953194332
      ├─docker-253:1-516365-773d6a80c02ebb3b9303c919d792b07bccb62987d7d27a3f410e4a5ada306b2c 252:4    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/773d6a80c02ebb3b9303c919d792b07bccb62987d7d27a3f410e4a5ada306b2c
      ├─docker-253:1-516365-949660ab1452d9a69fd363106445acb6f3fc81185145cad5091adccf7f3bfdc8 252:5    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/949660ab1452d9a69fd363106445acb6f3fc81185145cad5091adccf7f3bfdc8
      ├─docker-253:1-516365-87182cb88b7650a94758c9b305ca9963a1f17de9065e217fcc0ead75d18bf634 252:6    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/87182cb88b7650a94758c9b305ca9963a1f17de9065e217fcc0ead75d18bf634
      ├─docker-253:1-516365-5c420a5927b8e208aa1fdf17b7e305c6b2202bec1fe702d297f7dfd869934f10 252:7    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/5c420a5927b8e208aa1fdf17b7e305c6b2202bec1fe702d297f7dfd869934f10
      ├─docker-253:1-516365-b79b1e1cad9026efd6357feeb79d84ffda9f53ebe50ce49cf59f3679ac19529d 252:8    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/b79b1e1cad9026efd6357feeb79d84ffda9f53ebe50ce49cf59f3679ac19529d
      └─docker-253:1-516365-64e5c49b00db3f99b582325b736d1cb657cf8dac2892368a2bd58e4d05e7a860 252:9    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/64e5c49b00db3f99b582325b736d1cb657cf8dac2892368a2bd58e4d05e7a860
    loop1                                                                                      7:1    0    2G  0 loop 
    └─docker-253:1-516365-pool                                                               252:0    0  100G  0 dm   
      ├─docker-253:1-516365-37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10 252:1    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/37bcacd5592623173bb4887cfc87c74d57efab37acaa25506f18a6083c742c10
      ├─docker-253:1-516365-68daacf086ac074f8f0a21465c05d966ff22735fdf02120b380ac993d280683a 252:2    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/68daacf086ac074f8f0a21465c05d966ff22735fdf02120b380ac993d280683a
      ├─docker-253:1-516365-6b2d1832f9ed653b8a1e67687ac54a19297c32a94a909f7c6d94fe9953194332 252:3    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/6b2d1832f9ed653b8a1e67687ac54a19297c32a94a909f7c6d94fe9953194332
      ├─docker-253:1-516365-773d6a80c02ebb3b9303c919d792b07bccb62987d7d27a3f410e4a5ada306b2c 252:4    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/773d6a80c02ebb3b9303c919d792b07bccb62987d7d27a3f410e4a5ada306b2c
      ├─docker-253:1-516365-949660ab1452d9a69fd363106445acb6f3fc81185145cad5091adccf7f3bfdc8 252:5    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/949660ab1452d9a69fd363106445acb6f3fc81185145cad5091adccf7f3bfdc8
      ├─docker-253:1-516365-87182cb88b7650a94758c9b305ca9963a1f17de9065e217fcc0ead75d18bf634 252:6    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/87182cb88b7650a94758c9b305ca9963a1f17de9065e217fcc0ead75d18bf634
      ├─docker-253:1-516365-5c420a5927b8e208aa1fdf17b7e305c6b2202bec1fe702d297f7dfd869934f10 252:7    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/5c420a5927b8e208aa1fdf17b7e305c6b2202bec1fe702d297f7dfd869934f10
      ├─docker-253:1-516365-b79b1e1cad9026efd6357feeb79d84ffda9f53ebe50ce49cf59f3679ac19529d 252:8    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/b79b1e1cad9026efd6357feeb79d84ffda9f53ebe50ce49cf59f3679ac19529d
      └─docker-253:1-516365-64e5c49b00db3f99b582325b736d1cb657cf8dac2892368a2bd58e4d05e7a860 252:9    0  100G  0 dm   /var/lib/docker/devicemapper/mnt/64e5c49b00db3f99b582325b736d1cb657cf8dac2892368a2bd58e4d05e7a860
    
1 Answer

As already covered in the comments, if the block storage volume is not mounted it is safe to remove. About the Docker entries, it looks like Docker is configured to use the Device Mapper storage driver. This uses a concept called thin provisioning for storage which "relies on on-demand allocation of blocks of data versus the traditional method of allocating all the blocks in advance." That means that while Docker has created a local block device, it is not actually utilizing the full amount of space shown. You can find real usage info by running the docker info command and finding the "Storage Driver" section. It should look something like:

Storage Driver: devicemapper
 Pool Name: docker-thinpool
 Pool Blocksize: 524.3 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file:
 Metadata file:
 Data Space Used: 212.3 MB
 Data Space Total: 212.6 GB
 Data Space Available: 212.4 GB
 Metadata Space Used: 286.7 kB
 Metadata Space Total: 1.07 GB
 Metadata Space Available: 1.069 GB
# [ ... ]
Have another answer? Share your knowledge.