Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-21-2011, 07:38 PM
|
#1
|
LQ Newbie
Registered: Oct 2010
Posts: 22
Rep:
|
Grow LVM in extended partition.
I couldn't find a HOWTO that always works (even with LVM in extended partition).
Here's one...
Code:
First, shut down your VM and increase the disk size.
Then start your VM and go to the console.
# fdisk -u /dev/xvda
(-u shows sectors instead of cylinders. This is important)
(Make a note of the start sector of the LVM partition)
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 499711 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 501758 16775167 8136705 5 Extended
/dev/xvda5 501760 16775167 8136704 8e Linux LVM
(delete the LVM and/or Extended partition)
Command (m for help): d
Partition number (1-5): 2
(Create a new partition)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p (I choose primary but you may choose extended)
Partition number (1-4): 2 (choose one that's available)
(Fill in the start sector of the LVM partition we deleted above)
First sector (63-16777215, default 63): 501760
Last sector, +sectors or +size{K,M,G} (501760-16777215, default 16777215): (Enter)
(change created partition to Linux LVM)
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 499711 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 501760 16777215 8137728 8e Linux LVM
Command (m for help): w (write)
# reboot
(Resize physical volume)
# pvresize /dev/xvda2
(make a note of the VG "Free PE")
# vgdisplay
(make a note of the "LV Name" of the LV you want to resize)
# lvdisplay
(Resize LV. Fill in the found "Free PE" and "LV Name" (without the brackets))
# lvresize -l +[Free PE] [LV Name]
(resize the file system)
# resize2fs [LV Name]
# reboot
Thats all..
Hope this is useful to somebody.
Last edited by hansaplazt; 01-21-2011 at 07:47 PM.
|
|
|
07-20-2011, 10:03 AM
|
#2
|
LQ Newbie
Registered: Jul 2011
Posts: 1
Rep:
|
It was very useful for me.
Thank you very much.
Last edited by sefai; 07-21-2011 at 12:17 AM.
|
|
|
07-21-2011, 05:16 AM
|
#3
|
LQ Newbie
Registered: Oct 2010
Posts: 22
Original Poster
Rep:
|
Glad you liked it.
|
|
|
12-05-2011, 07:29 AM
|
#4
|
LQ Newbie
Registered: Dec 2011
Posts: 3
Rep:
|
Unfortunately this doesn't work for me
After performing the steps above I get the following message when booting.
Gave up waiting for root device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/AhsayOBS-root does not exist. Dropping to a shell!
BusyBox v1.13.3 (Ubuntu 1:1.13.3-1ubuntu11) built-in shell (ash)
Enter 'help' for a list of built-in commands.
(initramfs)
I'm running this Ubuntu 10.04.03 LTS on a XenServer v6.0
Any one else seen this?
|
|
|
12-05-2011, 08:05 AM
|
#5
|
LQ Newbie
Registered: Oct 2010
Posts: 22
Original Poster
Rep:
|
I presume you have created snapshot or backup of your VM?
Go back to it and start your VM (it should come up now). Can you post the output of "fdisk -u /dev/xvda" here? Assuming of course that /dev/xvda is the device you want to resize.
Last edited by hansaplazt; 12-05-2011 at 08:06 AM.
|
|
|
12-06-2011, 01:33 AM
|
#6
|
LQ Newbie
Registered: Dec 2011
Posts: 3
Rep:
|
Yes, that's correct. But I had to fix the space problem on that server immediately so had to solve it temporarily with mounting another partition into the filesystem to gain space where needed.
Although I've set up a similar Xen VM Guest server to continue tests on and it looked like this.
Disk /dev/xvda: 75.2 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00075641
Device Boot Start End Blocks Id System
/dev/xvda1 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 32 9138 73148417 5 Extended
/dev/xvda5 32 9138 73148416 8e Linux LVM
|
|
|
12-06-2011, 04:13 AM
|
#7
|
LQ Newbie
Registered: Oct 2010
Posts: 22
Original Poster
Rep:
|
You are showing me cylinders instead of sectors. This is important. What unix/linux flavour do you have? Check the fdisk man page for listing sectors (usually this is '-u')
|
|
|
12-06-2011, 05:55 AM
|
#8
|
LQ Newbie
Registered: Dec 2011
Posts: 3
Rep:
|
I'm running Ubuntu Lucid Lynx (10.04 LTS)
Okay, changed to sectors inside fdisk instead of on the command line which seems to work better.
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/xvda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders, total 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
Disk identifier: 0x00050338
Device Boot Start End Blocks Id System
/dev/xvda1 2048 499711 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 501758 33552383 16525313 5 Extended
/dev/xvda5 501760 33552383 16525312 8e Linux LVM
|
|
|
12-06-2011, 05:59 AM
|
#9
|
LQ Newbie
Registered: Oct 2010
Posts: 22
Original Poster
Rep:
|
That was probably the problem.
If you now follow my first post (exactly of course ) all should be fine.
|
|
|
02-10-2016, 10:31 AM
|
#10
|
LQ Newbie
Registered: Feb 2016
Posts: 1
Rep:
|
Thank You!
I know this is a really old post but I've been looking for the answer to this for a couple of days now and couldn't find it until I stumbled upon this! Thank's so much!
|
|
|
02-20-2016, 03:42 PM
|
#11
|
LQ Newbie
Registered: Feb 2016
Posts: 1
Rep:
|
Thanks hansaplazt for the post! You are awesome!
|
|
|
11-27-2016, 02:33 PM
|
#12
|
LQ Newbie
Registered: Nov 2016
Posts: 1
Rep:
|
Thanks a lot
Hello,
Your thread was very useful for me even 6 years before
Just wanted to note that on Debian 8 now some commands has changed that needs complete paths for LV (name is not enough anymore): - sudo lvresize -l +[Free PE] [LV Path]
sudo resize2fs [LV Path]
Thanks for your great post.
|
|
1 members found this post helpful.
|
12-15-2016, 11:44 AM
|
#13
|
LQ Newbie
Registered: Dec 2016
Distribution: RHEL
Posts: 18
Rep:
|
For RHEL 7*
Try running a rescan on the iscsi bus after adding or extending a drive to a VM:
echo "- - -" > /sys/class/scsi_host/host0/scan
Most of the time it will work and prevent you from having to do a reboot.
Since file systems have changed a bit, adding the following command for XFS since it doesn't use resize2fs:
xfs_growfs /dev/mapper/rhel-root00
|
|
|
04-11-2017, 11:41 AM
|
#14
|
LQ Newbie
Registered: Oct 2013
Posts: 1
Rep:
|
Still relevant in 2017.
Using Ubuntu 16.04.2 LTS (Server build). Thank you OP!
|
|
|
09-03-2019, 06:45 AM
|
#15
|
LQ Newbie
Registered: Sep 2019
Posts: 1
Rep:
|
Helped me in 2019, thank you very much!
|
|
|
All times are GMT -5. The time now is 11:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|