Skip to main content
Skip table of contents

How to Expand the Volume in Linux Instance?

To do this please make sure you have completed steps on following article:

https://sp.skyatlas.com/sp/How-to-Attach-Volume-to-Instance%3F.3248816137.html

 

You need to make the added volume available according to the instructions on this page. You can use the commands below for this.

 

CODE
$ sudo fdisk -l
Disk /dev/vda: 16 GiB, 17179869184 bytes, 33554432 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
Disklabel type: dos
Disk identifier: 0x577c3e7c

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 33554398 33552351  16G 83 Linux


Disk /dev/vdb: 16 GiB, 17179869184 bytes, 33554432 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

 

In the terminal output, the disk we added appears as /dev/vdb. You need to make this disk available. For this:

CODE
$ sudo fdisk /dev/vdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x3df53b17.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-33554431, default 2048): <press enter>
Last sector, +sectors or +size{K,M,G,T,P} (2048-33554431, default 33554431): <press enter>

Created a new partition 1 of type 'Linux' and of size 16 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

 

CODE
$ sudo mkfs.ext4 /dev/vdb1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 4194048 4k blocks and 1048576 inodes
Filesystem UUID: 041c14ac-7de5-450e-bd0f-2031f0ee6079
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done  


$ sudo mkdir -p /MOUNTPOINT
$ sudo mount /dev/vdb1 /MOUNTPOINT

After the process is completed, it is recommended that you can turn off your instance from the SkyAtlas Panel, but it is not necessary. After the instance is shut down, you need to detach the volume that is attached to your instance from the Volumes tab. To do this, you need to remove the disk from the Manage Attachments button in the Edit Volume section.

Then you have to click the Extend Volume button from the Edit Volume button again. On the screen that appears, you have to enter the new size of your disk partition.

After changing the disk size, you must add the disk back to your instance and restart your instance.

 

After your instance has started, you must connect to your instance. After connecting, you need to expand the file system of the expanded disk:

 

CODE
$ sudo growpart /dev/vdb 1
$ sudo e2fsck -f /dev/vdb1
$ sudo resize2fs /dev/vdb1
$ sudo mount /dev/vdb1 /MOUNTPOINT

You must run these commands sequentially. After these commands, the file system of your disk will be expanded and your disk will be ready for use.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.