How to Expand Partitions After Resizing a Volume
Validated on 24 Feb 2026 • Last edited on 27 Feb 2026
Volumes are network-attached block storage. You can use them with Droplets or Kubernetes clusters, move or resize them, and create snapshots at any time.
If you manually partitioned your volume when you created it, increasing its size also requires rewriting the partition table to expand the last partition, and then growing the filesystem on that partition to use the newly available space.
Volumes are unpartitioned by default. If you automatically formatted and mounted your volume or used the Config instructions under the More dropdown menu in the DigitalOcean Control Panel, your volume remains unpartitioned. In that case, follow the steps to resize an unpartitioned volume.
If you’re not sure whether your volume is partitioned, run the lsblk --fs command:
sudo lsblk --fs /dev/disk/by-id/use_your_volume_identifierIf the filesystem appears directly on the disk (for example, sda ext4), the volume is unpartitioned. If you see entries such as sda1, sda2, and so on, the volume is partitioned. For example, the following output shows an unpartitioned volume because the ext4 filesystem appears directly on sda:
NAME FSTYPE LABEL UUID MOUNTPOINT
sda ext4 18efad39-6b7c-44d3-ba21-b0778911c4ed /mnt/volume-nyc1-01
After you resize the volume itself, expand the last partition to use the new space by first rewriting the partition table, and then expanding the filesystem on the last partition.
Rewrite the Partition Table
We recommend using gdisk to rewrite GPT partition tables. It supports partition table backups, correctly relocates GPT metadata after resizing, and works with partitions of any size.
First, unmount all partitions on the volume.
Then, change to a writable directory, and then start gdisk with the volume identifier:
cd ~
sudo gdisk /dev/disk/by-id/use_your_volume_identifierThen, create a backup of the current partition table using the b command:
b
Enter backup filename to save: partition_table.bakEnter a filename for your current partition table’s backup file.
Then, use the x command to access the expert menu:
xThen, move the backup GPT data structures to the end of the disk with the e command:
e
Relocating backup data structures to the end of the diskThe e command is only available in the expert menu. After relocating the GPT metadata, return to the main menu using the m command, so you can safely run regular commands such as p, d, n, and w to modify and write the partition table.
m
Command (? for help):Expand the Last Partition
First, display the current partition table by running the p command:
pThe p command displays disk details and the current partition table:
...
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 209719229 sectors (100.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 209713151 100.0 GiB 8300 primaryConfirm that free space is available at the end of the disk, then note the values for only the last partition in the table. You reuse these values when recreating the partition so that only the ending sector changes.
The partition table lists the existing partitions. In this example, there is one partition:
- Number identifies the partition number (
1). - Start (sector) shows where the partition begins (
2048). - End (sector) shows where it currently ends.
- Size shows the current partition size (
100.0 GiB). - Code indicates the partition type (
8300, which represents a Linux filesystem). - Name shows the GPT partition name (
primary).
You must reuse these values when recreating the partition so that only its ending sector changes while its starting position and type remain the same.
Then, delete the last partition using the d command:
dThen, create a new partition using the n command:
nAccept the default partition number and default starting sector. For the Last sector, accept the default value to extend the partition to the end of the disk.
Partition number (1-128, default 1):
First sector (34-419430366, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-419430366, default = 419430366) or {+-}size{KMGTP}:
...If necessary, restore the original partition name using the c command:
cThen, verify the updated partition table using the p command:
pWrite the Changes
Write the new partition table using the w command:
wgdisk performs final checks and warns that writing the updated GPT data overwrites the existing partition table. Confirm by entering Y:
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N):gdisk writes the updated GPT table and exits:
OK; writing new GUID partition table (GPT) to /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01.
The operation has completed successfully.At this point, the last partition spans the full size of the resized volume.
Expand the Filesystem of the Last Partition
To expand the partitioned filesystem to use the additional space, first unmount the partition:
sudo umount /mnt/use_your_mount_pointThen, identify the filesystem type using the lsblk --fs command:
sudo lsblk --fsIf the FSTYPE column shows a filesystem on a partition such as sda1 or sda2, the volume is partitioned. For example, the following output shows a partitioned volume because the filesystems (ext4 and xfs) appear on sda1 and sda2, not directly on sda:
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ext4 37858ba9-c2f3-4afe-9013-83111111e862
└─sda2 xfs 5d141215-7473-4100-a0e2-e69d23d89ec5
...If your filesystem is unpartitioned and appears directly on the disk (for example, sda ext4), follow the steps to resize an unpartitioned volume.
First, check the filesystem using the e2fsck command:
sudo e2fsck -f /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1e2fsck runs several consistency checks in multiple passes. The final line summarizes the filesystem state and reports the number of files and blocks in use. If no errors are reported, the filesystem is clean and ready to be resized:
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
...
Pass 5: Checking group summary information
/dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1: 13/6553600 files (0.0% non-contiguous), 459351/26213888 blocksThen, expand the filesystem using the resize2fs command:
sudo resize2fs /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1resize2fs reports the new size of the filesystem in 4 KB blocks. The final line confirms that the filesystem has successfully expanded to fill the partition:
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1 to 52428539 (4k) blocks.
The filesystem on /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1 is now 52428539 (4k) blocks long.First, check the filesystem with the xfs_repair command:
sudo xfs_repair /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1xfs_repair runs through several verification phases. The final done message indicates that the filesystem check completed successfully and no blocking inconsistencies remain before expanding the filesystem:
Phase 1 - find and verify superblock...
Phase 2 - using internal log
...
Phase 7 - verify and correct link counts...
doneThen, mount the partition using the mount command as XFS must be mounted to grow:
sudo mount -aThen, expand the filesystem using the xfs_growfs command:
sudo xfs_growfs /mnt/volume-nyc1-01-part1xfs_growfs reports the change in data blocks. The increase in block count confirms that the filesystem has successfully expanded to use the additional space available in the partition:
...
data blocks changed from 26213888 to 52428539After expanding the filesystem, mount the partition again if needed. To verify the available space, run the df -h -x tmpfs -x devtmpfs command:
df -h -x tmpfs -x devtmpfsThis command displays disk usage information and excludes temporary filesystems, allowing you to confirm that the partition reflects the newly expanded size.