# Ensure a Separate Partition for Containers Has Been Created

- Source: https://support.icompaas.com/support/solutions/articles/62000234289-ensure-a-separate-partition-for-containers-has-been-created
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Docker Benchmark v1.7.0](https://support.icompaas.com/support/solutions/62000112687) › [CIS Docker Benchmark](https://support.icompaas.com/support/solutions/folders/62000169241)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Profile Applicability:**

-   **Level 1** 
    

**Description:**

Docker containers and their data are stored under the /var/lib/docker directory by default. To avoid storage-related issues, it is recommended to create a separate partition (logical volume) for Docker files, ensuring that the host system and Docker's storage do not interfere with each other.  

**Rationale:**

Docker uses /var/lib/docker as the directory for storing containers, images, and metadata. Without a dedicated partition, the disk could fill up quickly, which would render both Docker and the host system unusable. By creating a separate partition, the storage is isolated, preventing potential disruptions.  

**Impact:**

None: No direct impact on functionality, but it improves stability by ensuring that Docker's storage needs are isolated from the host system.  

**Default Value:**

By default, /var/lib/docker is mounted under the / or /var partitions, depending on the OS configuration.  

**Pre-requisites:**

-   Access to the host system with administrative privileges.  
    
-   Knowledge of Logical Volume Manager (LVM) or disk partitioning.  
    

**Remediation:**

**Test Plan:**

**Using AWS Console:**

1.  Navigate to the EC2 instance running Docker.  
    
2.  Run the command grep '/var/lib/docker\\s' /proc/mounts to confirm that /var/lib/docker is mounted correctly on a separate partition.  
    
3.  Alternatively, run mountpoint -- "$(docker info -f '{{ .DockerRootDir }}')" to verify whether the root directory is a mount point.  
    

**Using AWS CLI:**

1.  Connect to the EC2 instance.  
    
2.  Run the command  to check the Docker root directory and ensure it points to the appropriate partition.

docker info -f '{{ .DockerRootDir }}'

  

**Implementation Plan:**

**Using AWS Console:**

1.  Connect to the EC2 instance.  
    
2.  Create a new partition using a tool like LVM or a dedicated disk.  
    
3.  Mount the new partition to /var/lib/docker.  
    
4.  Modify /etc/fstab to ensure that the partition is mounted persistently after reboots.  
    
5.  Restart Docker to ensure the changes take effect:  
    

**Using AWS CLI:**

1.  Use SSM to remotely create a new partition and mount it for Docker storage.  
    
2.  Execute the following command to create the partition:  
    

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=instanceIds,Values=instance\_id" --parameters 'commands=\["sudo lvcreate -L 10G -n docker\_data docker\_vg && sudo mkfs.ext4 /dev/docker\_vg/docker\_data && sudo mount /dev/docker\_vg/docker\_data /var/lib/docker && sudo systemctl restart docker"\]'

  

**Backout Plan:**

**Using AWS Console:**

1.  Connect to the EC2 instance.  
    
2.  Unmount the partition using:  
    

sudo umount /var/lib/docker

       3. Remove the partition or reconfigure Docker to use the default directory.

      4. Restart Docker:

  

**Using AWS CLI:**

1.  Use SSM to remove the partition and revert to the default Docker directory:  
    

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=instanceIds,Values=instance\_id" --parameters 'commands=\["sudo umount /var/lib/docker && sudo rm -rf /var/lib/docker/\* && sudo systemctl restart docker"\]'

  

**References:**[](https://www.projectatomic.io/docs/docker-storage-recommendation/)  

-   [Docker Storage Recommendations  
    ](https://www.projectatomic.io/docs/docker-storage-recommendation/)
    
-   [Docker Storage Documentation](https://docs.docker.com/storage/)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
