A cuban around the globe

Resize EXT Partition on Hetzner Servers



Last month I had to increase the size of a Storage in a Hetzner Cloud Server. The routine is simple and really fast.

Hetzner Cloud offers a fast, flexible, and cost-effective SSD based Block Storage which can be attach to your Hetzner Cloud Server. At this point in time its available in the Nuremberg and Helsinki regions.

Step 1 – Preparations

Check the current partition table (it should look similar to this depending on the model):

# fdisk -l /dev/sda


Disk /dev/sdb: 102.4 GB, 102399737856 bytes
255 heads, 63 sectors/track, 12449 cylinders, total 199999488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00051eb3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    52426752    26212352+  83  Linux

Step 2 – Checking the File System

Check the file system with:

# e2fsck -f -C0 /dev/sda1


e2fsck 1.42.5 (29-Jul-2012)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 26283/1638400 files (5.6% non-contiguous), 283813/6553088 blocks

Step 3 – Resizing the File System

Resize the file system with:

# resize2fs /dev/sda1


resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/sda1 to 24999680 (4k) blocks.
The filesystem on /dev/sda1 is now 24999680 blocks long.

Reboot and check if the disk is larger.

Leave a Reply

Your email address will not be published. Required fields are marked *.

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

two + nineteen =