10

DISCOUNT

REGISTER NOW

How to Expand the Volume in Linux Instance?

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

https://support.skyatlas.com/hc/en-us/articles/115003656652-How-to-Attach-Volume-to-Instance-

 

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

 

$ 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:

$ 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.

 

$ 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.

mceclip0.png

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.

mceclip1.png

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:

 

$ 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.

 

Have more questions? Submit a request
Powered by Zendesk