Skip to main content

How to increase devmapper: Thin Pool or loop-lvm Size in Docker

Sometimes while we do any docker operation or build docker images, we might encounter devmapper: Thin Pool space issue.

daemon: devmapper: Thin Pool has 132480 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin
pool or use dm.min_free_space option to change behavior

We can resize a loop-lvm thin pool manually without any device-tool utility.

1. First grep the location of Data loop file.

    $ sudo docker info | grep loop
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata

2. Check the total size of loop0 device.

$ echo $[ $(sudo blockdev --getsize64 /dev/loop0) / 1024 / 1024 / 1024 ]
100

3. We will add 100GB in Data file: /dev/loop0, file path as per the above output:- /var/lib/docker/devicemapper/devicemapper/data

$ sudo truncate -s +100G /var/lib/docker/devicemapper/devicemapper/data 

4. set up and control loop devices and force loop driver to reread size of the file associated with the specified loop device

$ sudo losetup -c /dev/loop0 

5. Check the size of Data file.

$ ls -lhtr /var/lib/docker/devicemapper/devicemapper/data
-rw-rw-rw- 1 root root 200G Jan 27 05:06 /var/lib/docker/devicemapper/devicemapper/data

6. Now check the total size of loop0 device.

$ echo $[ $(sudo blockdev --getsize64 /dev/loop0) / 1024 / 1024 / 1024 ]
200

7. Get the pool name first which we will used to update its table.

$ sudo dmsetup status |grep 'thin-pool' |awk -F ': ' {'print $1'}
docker-202:81-14418666-pool

8. use low level logical volume management to outputs the current table for the device in a format that can be fed back in using  the  create  or  load  commands.

$ sudo dmsetup table docker-202:81-14418666-pool
0 209715200 thin-pool 7:1 7:0 128 32768 1 skip_block_zeroing

The second number (209715200) is the size of the device, which will need next to calculate the actual size of volume. 

9. Let’s compute how many sectors we need for a 100 GB volume. Per sector 512-bytes in a volume or Disk drive hence we will use first three 1024 for Giga bytes (GB) and divided by 512 bytes.

$ echo $((100*1024*1024*1024/512))
209715200

10. Now add both the value of step 8 and step 9.

209715200
 +209715200 = 419430400

11# The old table was 0 209715200 thin-pool 7:1 7:0 128 32768 1 skip_block_zeroing. We will change the second number, and be extremely careful about leaving everything else exactly as it is.

$ echo 0 419430400 thin-pool 7:1 7:0 128 32768 1 skip_block_zeroing | sudo dmsetup load docker-202:81-14418666-pool

If you face any permission error with above command then please execute it with root user.

12. Run the following command to activate new table.

$ sudo dmsetup resume docker-202:81-14418666-pool

13# Run the below command to check the table output.

$ sudo dmsetup table docker-202:81-14418666-pool
0 419430400 thin-pool 7:1 7:0 128 32768 1 skip_block_zeroing

14. Run command docker info to see the actual Data size.

    $ sudo docker info | grep Data
 Data file: /dev/loop0
 Data Space Used: 102.9GB
 Data Space Total: 204.8GB
 Data Space Available: 101.9GB
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data


Comments

Popular posts from this blog

How to configure a Datasource in JBoss / WildFly as a JAR Deployment

JDBC drivers can be installed as a JAR deployment using either the management CLI or the management console. As long as the driver is JDBC 4-compliant, it will automatically be recognized and installed as a JDBC driver upon deployment. 1. Download the appropriate JDBC driver from your database vendor. 2. Start the JBoss EAP/WildFly server. 3. Now most of the drivers coming with JDBC 4-compliant, but in case If the JDBC driver JAR is not JDBC 4-compliant, it can be made deployable using the following steps. i) Create a directory structure META-INF/services on your local system. $ mkdir -p META-INF/services    ii) Create a file inside META-INF/services/java.sql.Driver. $ touch META-INF/services/java.sql.Driver   iii) Add one line in the file to indicate the fully-qualified class name of the JDBC driver. $ echo “com.mysql.jdbc.Driver” > META-INF/services/java.sql.Driv...

Shift your Data into Virtualization

A single approach to data management that allows an application or user to retrieve and manipulate data without knowing any technical details about the data. That approach called Data Virtualization. Data Virtualization is different than traditional virtualization like - VMWare, Hypervisor, KVM, etc. because we already learned how to do virtualization of OS, Hardware and Storage, now time to add some more into virtualization, which is DATA. What is Data Virtualization? Data virtualization is a single window used to describe any approach to data management that allows an application to retrieve and manipulate data without requiring technical details about the data, such as how it is formatted, or where it is physically located. Why use Data Virtualization? Data virtualization promotes efficiency in data usage and processing and accelerates time to market on projects with complex data storage infrastructure. The purpose is to allow data to be accessed without creating extra ...

How to Install JBOSS EAP 7.0.0 on RHEL6.5/CentOS6.5 – a step by step tutorial of INSTALLER Installation

INTRODUCTION In this tutorial, we will demonstrate how to install and start a JBoss EAP 7.0.0 server on RHEL 6.5/CentOS 6.5. We use Oracle JDK 8 for this tutorial. This Tutorial Consists Of The Following Steps: Step 1: Download installer link Step 2: JDK installation and verification Step 3 to Step 14: JBoss EAP 7 installation procedure using INSTALLER Installation Step 15: Start Jboss EAP 7 server Red Hat JBoss EAP 7.0 is based on Wildfly 10 , and provides pre-configured options for features such as high-availability clustering, messaging, and distributed caching. And it is an application server that works as a middleware platform, is built on open standards, and is compliant with the Java EE 7 specification. Step 1: Download the installer from: https://developers.redhat.com/products/eap/download/ Select the EAP 7.0.0 (Developers version) from the list. Click on Installer option within Download column. For Linux/ Windows/Mac...