# Increase container volume(disk) size

**URL:** <https://forums.docker.com/t/increase-container-volume-disk-size/1652>\
**Category:** General\
**Created:** [May 25, 2015, 2:49pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652 "2015-05-25T14:49:49Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![gugansankar](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gugansankar](https://forums.docker.com/u/gugansankar)\
**Post date:** [May 25, 2015, 2:49pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/1 "2015-05-25T14:49:49Z")

</div>

Hi,

Can someone please let me know how to increase the volume(disk) size of container ?.

Once I deployed the container, I just look at the disk space allocated to docker. Just 10GB has allocated to this. Is there any option to set the disk size to 100GB? . I have 1TB Hard disk size

[root@fa10q3907qab ~]# df -h  
Filesystem Size Used Avail Use% Mounted on  
rootfs 9.8G 878M 8.4G 10% /

Thanks.

---

<div class="post-metadata">

**Author:** ![gugansankar](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gugansankar](https://forums.docker.com/u/gugansankar)\
**Post date:** [May 26, 2015, 9:57am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/2 "2015-05-26T09:57:14Z")

</div>

Please someone help me on this. Still I’m wondering to get my problem resolved completely

---

<div class="post-metadata">

**Author:** ![k3ck3c](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@k3ck3c](https://forums.docker.com/u/k3ck3c)\
**Post date:** [May 26, 2015, 2:31pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/3 "2015-05-26T14:31:58Z")

</div>

Read [https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/](https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/) and the more recent [http://jpetazzo.github.io/assets/2015-03-03-not-so-deep-dive-into-docker-storage-drivers.html#1](http://jpetazzo.github.io/assets/2015-03-03-not-so-deep-dive-into-docker-storage-drivers.html#1)

---

<div class="post-metadata">

**Author:** ![sgibney](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@sgibney](https://forums.docker.com/u/sgibney)\
**Post date:** [July 16, 2015, 8:16am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/4 "2015-07-16T08:16:56Z")

</div>

With Centos 7 I did the following to increase the default size of the containers

Modify the docker config in /etc/sysconfig/docker-storage to add the line:  
DOCKER\_STORAGE\_OPTIONS= - -storage-opt dm.basesize=20G  
service docker stop  
rm /var/lib/docker **NOTE THIS DELETES ALL IMAGES etc. SO MAKE A BACKUP**  
service docker start  
docker load \< [each\_save\_in\_backup.tar]  
docker run -i -t [imagename] /bin/bash

In the bash prompt of the docker container “df -k” should show 20GB / file system size now.

---

<div class="post-metadata">

**Author:** ![carljmosca](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/carljmosca/32/1531_2.png) [@carljmosca](https://forums.docker.com/u/carljmosca)\
**Post date:** [August 6, 2015, 1:03pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/5 "2015-08-06T13:03:02Z")

</div>

With respect to resizing existing containers, I am not able to get the resize2fs command to succeed.

Can anyone shed additional light on this?

---

<div class="post-metadata">

**Author:** ![shekhar15](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@shekhar15](https://forums.docker.com/u/shekhar15)\
**Post date:** [October 17, 2015, 7:34am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/6 "2015-10-17T07:34:34Z")

</div>

I have installed docker on Linux machine. Then i pulled an image of Red Hat Linux 7. I tried the above approach but was unable to increase the size. Does anyone have any idea regarding this?

---

<div class="post-metadata">

**Author:** ![balav74](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@balav74](https://forums.docker.com/u/balav74)\
**Post date:** [May 27, 2016, 5:34am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/7 "2016-05-27T05:34:29Z")

</div>

I am wondering if you could give me some pointerss on a docker issue that I am facing. I am trying to increase the default fs size for containers created on OEL 7.1/docker 1.6.1 combination. I have tried setting

DOCKER\_STORAGE\_OPTIONS= --storage-opt dm.basesize=20G

in /etc/sysconfig/docker-storage

and also followed the instructions on the below link for reseting the sparse file size

[https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/](https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/)

but even after the above, my ‘docker info’ is showing 'Data Space Total: 107.4 GB’ and new container’s default size is 10G. Any pointers?.

---

<div class="post-metadata">

**Author:** ![dvohra](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dvohra/32/5429_2.png) [@dvohra](https://forums.docker.com/u/dvohra)\
**Post date:** [May 27, 2016, 10:37am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/8 "2016-05-27T10:37:33Z")

</div>

–storage-driver=devicemapper --storage-opt dm.basesize=20G

> <https://github.com/snitm/docker/blob/master/daemon/graphdriver/devmapper/README.md>

---

<div class="post-metadata">

**Author:** ![liwey](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@liwey](https://forums.docker.com/u/liwey)\
**Post date:** [November 2, 2017, 10:49am UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/9 "2017-11-02T10:49:43Z")

</div>

> [@sgibney](#):
>
> /etc/sysconfig/docker-storage

No such file. No such file.

---

<div class="post-metadata">

**Author:** ![dvirarad](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@dvirarad](https://forums.docker.com/u/dvirarad)\
**Post date:** [March 20, 2018, 3:27pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/10 "2018-03-20T15:27:57Z")

</div>

Hi  
I am using docker 17.05.0-c ubuntu 16.04  
/etc/sysconfig/docker-storage this file does now exist

Does anyone know how to resize the docker volume?

---

<div class="post-metadata">

**Author:** ![ncostis](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@ncostis](https://forums.docker.com/u/ncostis)\
**Post date:** [February 28, 2019, 1:31pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/11 "2019-02-28T13:31:44Z")

</div>

Just create it. i did it, restarted docker and worked

---

<div class="post-metadata">

**Author:** ![jackyjak](https://avatars.discourse-cdn.com/v4/letter/j/eada6e/32.png) [@jackyjak](https://forums.docker.com/u/jackyjak)\
**Post date:** [October 12, 2020, 2:51pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/12 "2020-10-12T14:51:05Z")

</div>

I have had hell understanding the resize2fs.  
that’s how I got it working :

First, my context is as follow :  
I store my container’s volume in a file image.  
Then I try to resize it.

```auto
#make a 2GB file that will be used as a filesystem
truncate -s 2G my_fs

# format file as an ext4 filesystem
mkfs.ext4 ./my_fs

# mount the filesystem in my_dir
mkdir ./my_dir
sudo mount -o loop ./my_fs ./my_dir

```

`my_dir` can now be mounted in a docker container using the volume option

if the container is running out of space  
pause the container with `docker container pause 0123456789`

first, find the loop device where `my_dir` is mounted:  
`lsblk`

then

```auto
#add 3GB to the filesystem
truncate -s +3G 

sudo partprobe -s /dev/loop0
sudo losetup -c /dev/loop0

# check the size of the partition : 
sudo fdisk -l /dev/loop0

#resize the filesystem :
sudo resize2fs /dev/loop0

#check the new size
df -h /dev/loop0

#voila !!

```

now unpause the container with `docker container unpause 0123456789`

---

<div class="post-metadata">

**Author:** ![seqwait](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/seqwait/32/29536_2.png) [@seqwait](https://forums.docker.com/u/seqwait)\
**Post date:** [February 25, 2021, 3:52pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/13 "2021-02-25T15:52:25Z")

</div>

just upgrade to overlay2!

---

<div class="post-metadata">

**Author:** ![maxblasdel](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@maxblasdel](https://forums.docker.com/u/maxblasdel)\
**Post date:** [May 12, 2021, 7:03pm UTC](https://forums.docker.com/t/increase-container-volume-disk-size/1652/14 "2021-05-12T19:03:54Z")

</div>

Can you please explain why overlay2 is the better system? I have overlay2 enabled with WSL.

Do you know if this means there is no default size limit on disk images with overlay2 storage?
