Search This Blog

Wednesday, March 14, 2018

Increasing the SYstem.img file

Increasing the SYstem.img file

Attach the System.im file to Dom-0

xm block-attach 0 file:///OVS/xxxx/System.img xvda w


Resize the file

qemu-img resize xxxxx/System.img +40G


fidsk /dev/xvda

Disk /dev/xvda: 55.8 GB, 55834574848 bytes
64 heads, 32 sectors/track, 53248 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005f11b

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           2         503      514048   83  Linux
/dev/xvda2             504       51200    51913728   83  Linux
/dev/xvda3           51201       53248     2097152   83  Linux

Detach the Block storage

xm block-detach 0 xvda

Delete the partion 3 and 2 using the fdisk commands and then create a partition 2 with the start and end size as  504       51200

Similarly create a swap partition with he size  51201       53248 


Restart the Oracle VM after this 

Run the command 

df -h

Filesystem                        Size  Used Avail Use% Mounted on
/dev/xvda2                        9.4G  3.1G  5.9G  34% /
tmpfs                             3.0G  199M  2.8G   7% /dev/shm
/dev/xvda1                        479M   49M  405M  11% /boot
/dev/xvdb                          50G  6.6G   41G  15% /fmw11g

You will see the size as still 9.4G instead of 50GB , 

Resize the file to occupy the space

 resize2fs -f /dev/xvda2

resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/xvda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/xvda2 is now 12978432 blocks long.



 fdisk -l

Disk /dev/xvda: 55.8 GB, 55834574848 bytes
64 heads, 32 sectors/track, 53248 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005f11b

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           2         503      514048   83  Linux
/dev/xvda2             504       51200    51913728   83  Linux
/dev/xvda3           51201       53248     2097152   83  Linux


Enable the swap space



mkswap /dev/xvda3

swapon  /dev/xvda3

To make this swap space partition available even after the reboot, add the following line to the /etc/fstab file.
# cat /etc/fstab
/dev/sdc1 swap swap defaults 0 0


After this reboot the guest machine.




Tags: Publish
March 13, 2018 at 04:13PM
Open in Evernote

No comments: