2 ways to increase the size of the Xen virtual hard disk in Linux

Source: Internet
Author: User

Method One

The mirror provided by Stacklet is too small, only 10G, so it has to be manually added.

Add 40G to the mirror

The code is as follows Copy Code
DD If=/dev/zero of=imcat.centos.img bs=1g conv=notrunc count=1 seek=40
1+0 Records in
1+0 Records out
1073741824 bytes (1.1 GB) copied, 51.9901, 20.7 MB/s

Scan for mirrored files:

The code is as follows Copy Code
Losetup-d/dev/loop0
Losetup/dev/loop0 imcat.centos.img
E2fsck-f/dev/loop0
Resize2fs/dev/loop0
E2fsck-f/dev/loop0
Losetup-d/dev/loop0

Method Two

To turn off the virtual machine:

The code is as follows Copy Code

#/USR/SBIN/XM Shutdown VM01

Append 4GB space to the virtual machine image file (. img):

The code is as follows Copy Code

# dd If=/dev/zero bs=1024k count=4096 >>/vm/vm01.img

Scan for mirrored files:

The code is as follows Copy Code

#/sbin/e2fsck-f/vm/vm01.img

This time just increased the size of the mirrored file (hard disk), this image file is not a normal file, which contains a mount/umount loop file system, so you need to adjust the file system size, otherwise enter the virtual machine DF will find the size of the hard drive:

The code is as follows Copy Code

#/sbin/resize2fs/vm/vm01.img

To restart the Xen virtual machine:

The code is as follows Copy Code

#/USR/SBIN/XM Create Vm01

To view the size of your hard disk after entering the virtual machine:

  code is as follows copy code

#/usr/sbin /XM console vm01

# df-h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.