Hi all!
I've got a VM at work running C6 on HyperV (no, its not my fault, that's what the company uses. I'd rather gag myself than own one of th ose things.)
I ran out of disk space in the VM, so the admin enlarged the virtual disk. but now I realize I don't know how to enlarge the partition and its filesystem.
I'll be googling, but in case I miss it, it'd be great if someone could point me in the right direction.
thanks!
Fred
Hi Fred, That would depend on what the underlying device is using. Do you know if you are using LVM or not?
Type `lvdisplay` at the console to display any logical volumes. If you are using LVM, you should see one named something like 'VolGroup00_lv-root' If this is the case, something like this should help, but I have listed out the steps below for the TL;DR version: https://wiki.centos.org/TipsAndTricks/ExpandLV
*pvcreate /dev/xvdb* (xvdb is the Xen version, you may see sdb or some other combination.) *vgextend VolGroup00 /dev/xvdb* (Where VolGroup00 is the Volume Group you found before) *lvextend -l +100%FREE /dev/VolGroup00/lv-root* (Or where ever the LVM device is created. lvdisplay will show you this.)
Then simply: *resize2fs /dev/VolGroup00/lv-root* to expand the filesystem on the new block device.
Hope that helps.
Cheers, Ian
On 19 May 2016 at 05:33, Fred Smith fredex@fcshome.stoneham.ma.us wrote:
Hi all!
I've got a VM at work running C6 on HyperV (no, its not my fault, that's what the company uses. I'd rather gag myself than own one of th ose things.)
I ran out of disk space in the VM, so the admin enlarged the virtual disk. but now I realize I don't know how to enlarge the partition and its filesystem.
I'll be googling, but in case I miss it, it'd be great if someone could point me in the right direction.
thanks!
Fred
--
Under no circumstances will I ever purchase anything offered to me as the result of an unsolicited e-mail message. Nor will I forward chain letters, petitions, mass mailings, or virus warnings to large numbers of others. This is my contribution to the survival of the online community.
--Roger Ebert, December, 1996
----------------------------- The Boulder Pledge
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On 19/05/16 05:33, Fred Smith wrote:
I'll be googling, but in case I miss it, it'd be great if someone could point me in the right direction.
thanks!
Fred
You'll need to use an external tool (such as gparted) to extend the partition to use up the new extent, then follow what Ian Brown suggested.
Had the admin simply added a new drive, then you'd follow what Ian Brown recommended without having the need to use an external tool.
My $0.02, ak.
On Thu, May 19, 2016 at 09:23:16AM +1000, Anthony K wrote:
On 19/05/16 05:33, Fred Smith wrote:
I'll be googling, but in case I miss it, it'd be great if someone could point me in the right direction.
thanks!
Fred
You'll need to use an external tool (such as gparted) to extend the partition to use up the new extent, then follow what Ian Brown suggested.
I've used gparted live cd a number of times, but don't think I knew that it handled lvm2 also. Since it does, if I resize the lvm, wouldn't the contained filesystem be automatically resized too? (as it has been when I've resized physical partitions containing NTFS and EXT2/3/4 filesystems.)
Had the admin simply added a new drive, then you'd follow what Ian Brown recommended without having the need to use an external tool.
yeah, in hindsight (which is always 20-20) it would have been easier.
A problem I have is that I have no admin access to the HyperV server, at all, AFAIK I cannot even boot up a live CD in that VM without getting admin help. I'd certainly want to do this resizing when the system in that VM is not running on the LVM I'm resizing, so I'll have to see if I can get the admin to boot up the gparted live cd for me.
thanks to both you and Ian!
Fred
On 19/05/16 09:54, Fred Smith wrote:
I've used gparted live cd a number of times, but don't think I knew
that it handled lvm2 also.
Well, what you are doing with gparted has nothing to do with LVM; just the drive (really, the image file) itself - similar to buying a bigger hdd and then cloning from old (smaller) to new (bigger). Then you have to boot into the system and extend the volume group, logical volume, and ultimately the filesystem.
Since it does, if I resize the lvm, wouldn't the contained filesystem
be automatically resized too? (as it has been when I've resized physical partitions containing NTFS and EXT2/3/4 filesystems.)
With lvm, lvextend can automatically resize the the underlying ext2/3/4 filesystem for you if you add the extra *-r* option. If you omit it, then you'll need to run *resize2fs* as detailed by Ian. As for NTFS, yes, once you use finish off with gparted, then the filesystem will have been automatically resized to fill the entire partition (haven't worked on partitioning in windows for a while so don't quote me).
ak.
*Note* Now that I'm having a second look at Ian's instructions, the pvcreate command is not required as you are not adding a second drive, just making the original one bigger.
Can you get buy with using lvm features, i.e., just add the chunk to the volume you want.
Use cfdisk to create a new partition (sudo cfdisk /dev/sda)
Select the unused space, create new partition and then select write, then quit.
reboot for changes to take. Go in to lvm, then finally use resize2fs and your extra space will now be used in the system.
$ sudo lvm lvm> pvcreate /dev/sda4 Physical volume "/dev/sda4" successfully created
lvm> pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_c6 lvm2 a-- 60.43g 0 /dev/sda3 vg_c6 lvm2 a-- 17.20g 0 /dev/sda4 lvm2 --- 19.53g 19.53g
lvm> vgextend vg_c6 /dev/sda4 Volume group "vg_c6" successfully extended
lvm> lvextend -l +100%FREE /dev/vg_c6/lv_home Size of logical volume vg_c6/lv_home changed from 22.06 GiB (5648 extents) to 41.59 GiB (10647 extents). Logical volume lv_home successfully resized
lvm> quit Exiting.
$ sudo resize2fs /dev/vg_c6/lv_home resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/vg_c6/lv_home is mounted on /home; on-line resizing required old desc_blocks = 1, new_desc_blocks = 3 Performing an on-line resize of /dev/vg_c6/lv_home to 10902528 (4k) blocks. The filesystem on /dev/vg_c6/lv_home is now 10902528 blocks long.
-------------
-wes
On Wed, May 18, 2016 at 1:33 PM, Fred Smith fredex@fcshome.stoneham.ma.us wrote:
Hi all!
I've got a VM at work running C6 on HyperV (no, its not my fault, that's what the company uses. I'd rather gag myself than own one of th ose things.)
I ran out of disk space in the VM, so the admin enlarged the virtual disk. but now I realize I don't know how to enlarge the partition and its filesystem.
I'll be googling, but in case I miss it, it'd be great if someone could point me in the right direction.
thanks!
Fred
--
Under no circumstances will I ever purchase anything offered to me as the result of an unsolicited e-mail message. Nor will I forward chain letters, petitions, mass mailings, or virus warnings to large numbers of others. This is my contribution to the survival of the online community.
--Roger Ebert, December, 1996
----------------------------- The Boulder Pledge
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos