In many ways, a global directory is like a telephone directory. Just as a telephone directory helps you find the phone number (and the address) given a person's name, the same way a global directory helps GT.M and its run-time processes find the database file of a given M global variable name. For example, consider the following illustration.
I need to resize my first disk (/dev/xvda) from 40 GB to 80 GB. I'm using XEN virtualization, and the disk is resized in XenCenter, but I need to resize its partitions without losing any data. The virtual machine is running Debian 8.6.
Rui F Ribeiro40.6k1616 gold badges8989 silver badges150150 bronze badges
Oldřich ŠvédaOldřich Švéda
2 Answers
This should be relatively easy, since you're using LVM:
- First, as always, take a backup.
- Resize the disk in Xen (you've already done this; despite this, please re-read step 1).
- Use parted to resize the extended partition (
xvda2
); runparted /dev/xvda
, then at the parted promptresizepart 2 -1s
to resize it to end at the end of the disk (BTW:quit
will get out of parted). - Either (a) create another logical partition (
xvda6
) with the free space, then:- reboot to pick up the partition table changes
pvcreate /dev/xvda6
vgextend xenhosting-vg /dev/xvda6
or (b)- extend xvda5 using
resizepart 5 -1s
- reboot to pick up the partition table changes
pvresize /dev/xvda5
- Finally, if you want to add that to your root filesystem,
lvextend -r -l +100%FREE /dev/xenhosting-vg/root
. The-r
option tolvextend
tells it to callresize2fs
itself.
Another option you didn't consider:
Add another virtual disk. If you can do this in Xen w/o rebooting the guest, then you can do this entirely online (without any reboots). Partition the new disk
derobertderobertxvdc
(this will not requite a reboot, since its not in use), then proceed with pvcreate
& vgextend
using /dev/xvdc1
.![Debian Debian](/uploads/1/2/4/6/124696076/365383174.png)
77.6k88 gold badges170170 silver badges228228 bronze badges
I'm currently running Devuan Jessie 1.0 (Stable) in a VM on ProxMox. The partition I needed to extend was
/var/lib
mounted on /dev/sda5
for elasticsearch. Since this wasn't OS critical, I could do it with the VM up. I just ensured that there was nothing using the partition with lsof
. To accomplish this, I did the following:- Check the partition to make sure it's not busy:
- If you get any output from this command, you must determine what is using the partition in question and terminate the process. Here is a reference. LSOF Comand Examples
- Unmount the partition:
- Run parted
- Inside parted:
- Quit parted:
- Check the disk:
- Extend the disk so the OS sees it:
- Remount:
- Check to make sure the OS sees the newly extended drive:
Now everything should be good to go. On a side note,
lvextend
threw an error, so for me, the resize2fs
route was the simplest way to go. HTH. Linux O'BeardlyLinux O'Beardly
Not the answer you're looking for? Browse other questions tagged debianfdiskresize2fs or ask your own question.
I have a virtual server under VMware, where I got 10 more GB harddisk from the sysadm.
Inside Linux (running Ubuntu 11.04 server), things are set up with LVM. In [c]fdisk, I do find these extra 10 gigs - they are present directly after the primary LVM partition.
I understand that I could make a new LVM partition out of this extra space, and then add this to the volume group, and then to the logical volume, and then resize the filesystem.
However, is it possible to assimilate these extra gigs into the existing LVM partition? So that the LVM's view of the physical volume increased instead of adding another physical volume into the volume group (preferably automatically percolating up to the volume group)?
stolsvik
stolsvikstolsvik3,74566 gold badges3434 silver badges4848 bronze badges
4 Answers
I just built a test virtual machine with a 15GB disk and LVM on /dev/sda2. Then I grew the disk to 20GB and made LVM see the extra 5GB without adding another physical volume.
Here are the steps I followed:
- apt-get install gnu-fdisk (or yum install gnu-fdisk)
I had to use gfdisk to make the whole thing work. No luck with the 'standard' fdisk.
- gfdisk /dev/sda
Switch to 'sectors' as the unit (this is critical!!!) and print the partition table:
Write down the 'start' sector of the 'Linux LVM' partition (/dev/vda2). Delete the partition and recreate it using the same 'start' sector (501758) and the same partition type (8e):
WARNING: please note that I didn't accept the default start sector for the partition, I entered it manually so that it matches the original value! I did accept the default value for the 'last sector' though, because I want this partition to be as large as the disk.
Verify that you did everything correctly with 'p' and write the new partition table to disk:
Reboot the virtual machine.Now log-in the virtual machine and run:
Done! Now run vgdisplay and you will see the extra 5GB available as free extents.
CAVEATS:
- If LVM is not the last (or only) partition on the virtual machine disk, you might have an hard time extending the size of the partition. It might even be impossible.
- If LVM is on a logical partition (which is where Debian puts it by default at install time) or in other words if LVM is on /dev/sda5 instead of /dev/sda2, you must write down the starting sector of both the extended partition (let's call it /dev/sda2) and the logical partition (let's call it /dev/sda5), then delete both partitions, then recreate them with the same starting sector. The last sector of both /dev/sda2 and /dev/sda5 should be the last sector of the disk.
- Since this is a risky procedure I recommend doing a backup of the virtual machine before attempting it.
Luca GibelliLuca Gibelli
Here are the instructions I always use when I'm doing the same thing...
Do “fdisk –l /dev/sda” I’m assuming /dev/sda2 is your LVM partition and you don’t have a /dev/sda3. Adjust the instructions to match your config.
1) Make sure you have expanded the VM disk.
2) do “fdisk /dev/sda”
- p (to see existing partitions)
- n (new partition)
- p (primary partition) -- give it the next available partition number, probably 3
- accept the defaults. It will use the rest of the disk
- w (write changes)
3) REBOOT
4) run ‘pvcreate /dev/sda3’
5) run ‘vgdisplay’ to get the name of the volume group. In this example, it’s “VolGroup”, as in:
6) run vgextend VolGroup /dev/sda3
7) run “df” to see the name of the root volume group.
8) run lvextend /dev/mapper/VolGroup-lv_root -r -l+100%FREE ( the (-r) option causes it to format it, too)
9 run “df –h” to see your new disk space
gpayne_007gpayne_007
This is one of the reasons I prefer to have one big physical volume on the VMs that is separate from the /boot and other initial parts. This allows you to create a whole disk as an LVM physical disk (
pvcreate /dev/sdb
). Then if you need to do a resize, none of the file system changes need to happen because it is directly on disk.In that scenario, you simply run
JosiahJosiahpvresize /dev/sdb
and move on with your vgextend, lvextend and resize2fs. Much simpler to maintain.95822 gold badges1212 silver badges2727 bronze badges
Personally I followed the instruction in this blog.
To summarize the steps:
- Increase the virtual disk size using the vm-ware tools
vmware-vdiskmanager
- Boot on another system (GParted live CD or mount an Iso CD-ROM to boot on)
- Use the Gparted tools (easy and graphic interface) to increase the recently expended drive
- remove the CD-ROM (or the ISO) and boot on the original partition.
For expanding my Linux VM (RedHat EL 6) I did boot on the GParted ISO image (from here) and I was able to extend the partition I wanted. Note I had to move the partition I wanted unchanged at the end.
It was safe with one of my colleague as well, but I would recommand to backup the VM before running Gparted Linux.
рüффпрüффп3,5341414 gold badges5656 silver badges9494 bronze badges