Thursday, January 14, 2021

resize boot volume in oracle cloud infrastructure aka OCI for a Linux instance

 

The Oracle Cloud Infrastructure Block Volume service lets you scaleup the size of block volumes and boot volumes. Well, one fine day, my boot volume was short of space and i was looking for some vaccum in my  mount point. I had the challenge, where  /u01 was mounted on boot volume and it had free space of 30 GB only. My requirement was to have around 150 GB. Thanks to OCI, we can scale up the boot volume. 

P.S:-As per https://docs.oracle.com/en-us/iaas/Content/Block/Tasks/resizingavolume.htm, we cannot scale up IDE type boot volume. Also we cannot scale down the boot volume.

 

Open the navigation menu in Oracle Cloud Infrastructure console. Under Core Infrastructure, go to Compute and click Boot Volumes.

 



 

 

In the Boot Volumes list, click the boot volume you want to resize.Click Edit Size or Performance.Specify the new size in VOLUME SIZE (IN GB). You must specify a larger value than the boot volume's current size.

 

 

 

After the volume is provisioned, for the volume resize to take effect, Log on to your instance and then paste and run the rescan commands
 
1. Run the applicable rescan commands.
sudo dd iflag=direct if=/dev/<device_name> of=/dev/null count=1
echo "1" | sudo tee /sys/class/block/<device_name>/device/rescan
2. Extend the partition manually. 
[opc@apps ~]$ sudo su -
Last login: Mon Jan 11 14:17:16 GMT 2021 on pts/0
[root@apps ~]# df -kh
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G   25M  7.2G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3       367G  333G   35G  91% /
/dev/sda1       200M  8.6M  192M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/994
tmpfs           1.5G     0  1.5G   0% /run/user/1000
 
Now, extend the partition

[root@apps ~]# sudo /usr/libexec/oci-growfs
CHANGE: partition=3 start=17188864 old: size=769243102 end=786431966 new: size=1031387102 end=1048575966
Confirm? [y/n]y
CHANGED: partition=3 start=17188864 old: size=769243102 end=786431966 new: size=1031387102 end=1048575966
meta-data=/dev/sda3              isize=256    agcount=39, agsize=2515200 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0 rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=96155387, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=4912, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 96155387 to 128923387
 
 
Confirm the changes
 
[root@apps ~]# df -kh
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.2G     0  7.2G   0% /dev
tmpfs           7.3G     0  7.3G   0% /dev/shm
tmpfs           7.3G   25M  7.2G   1% /run
tmpfs           7.3G     0  7.3G   0% /sys/fs/cgroup
/dev/sda3       492G  333G  160G  68% /
/dev/sda1       200M  8.6M  192M   5% /boot/efi
tmpfs           1.5G     0  1.5G   0% /run/user/994
tmpfs           1.5G     0  1.5G   0% /run/user/1000
[root@apps ~]#

 

 In this post, i have tried to demonstrate on how we can scale up the boot volume online in Oracle Cloud Infrastructure. Hope it helps someone. Happy learning Cloud.

 

 

1 comment:

  1. Excellent article. It clears my doubt about resizing the partition on Oracle Cloud. Thank you.

    ReplyDelete