l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2010 Apr 10 21:51

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] Increasing the size of my partition a snap!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Increasing the size of my partition a snap!

I often think that if I went into marketing, I could have made millions.
But, it would have been selling stupid stuff that no one would use. 

I have a system running Xen, and I was curious how to make the disk
bigger if I needed to. Here's how I did it. small is the name of the
host running dom0. It's also the name of the Physical Volume used by

Installed Debian onto an LVM partition leaving 700GB not used, leaving it
for LVM based VMs using Xen. 

small:/etc/xen-tools# lvscan 
  ACTIVE            '/dev/small/root' [6.52 GB] inherit
  ACTIVE            '/dev/small/swap_1' [5.74 GB] inherit
  ACTIVE            '/dev/small/lvhome' [279.39 GB] inherit

     Name            Flags          Part Type      FS Type               [Label]             Size (MB)
     sda1            Boot            Primary       Linux ext3                                   254.99
     sda2                            Primary       Linux LVM                                 999947.29

Install Debian and xen-tools.

small:/etc/xen-tools# egrep -v '^#|^ *$' /etc/xen-tools/xen-tools.conf
lvm = small

Created a virtual machine that originally had 8Gb

xen-create-image --hostname=xen2.brie.com --size=8Gb --swap=2048Mb --ip= --memory=1024Mb --arch=amd64

As you can see, the LVM partition only shows 8Gb

small:/etc/xen-tools# lvscan 
  ACTIVE            '/dev/small/xen2.brie.com-swap' [2.00 GB] inherit
  ACTIVE            '/dev/small/xen2.brie.com-disk' [8.00 GB] inherit

Shut down the VM. I think you can actually do this to a live VM, but for
this, I just shut it down. No need to pull out the scalpel for this one.

# xm shutdown xen2.brie.com

Add the extra space to the Logical Volume used by the xen2 VM.

# lvextend -L +4G /dev/small/xen2.brie.com-disk

fsck the partition

# e2fsck -f /dev/small/xen2.brie.com-disk

Resize it!

# resize2fs /dev/small/xen2.brie.com-disk

Start my VM with its additional disk space!

# xm create /etc/xen/xen2.brie.com

Is that trick or what?

Brian Lavender

"Those that fail to learn from history, are doomed to repeat it." 
- Winston Churchill
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.