Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I successfully resized my centos vdi in virtualbox with command VboxManage.exe modifyhd Centos.vdi --resize 12000 But when i started Centos i got error messages that gnome power manager not been installed correctly, also starting Avahi and postfix daemons failed, and after that i haven't gnome screen at all. How do i could fix the situation?

I rolled back to initial state, before resizing and added a new volume instead, the new Q is how to expand a vg_localhost?
output of vdisplay:

--- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_localhost
  PV Size               8,51 GiB / not usable 3,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              2178
  Free PE               0
  Allocated PE          2178
  PV UUID               Z4g5Cc-

  "/dev/sdb2" is a new physical volume of "12,51 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb2
  VG Name
  PV Size               12,51 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               oDCocH-

I did extension of vg and lvresize but still in trouble

lsblk
NAME                          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb                             8:16   0    20G  0 disk
├─vg_localhost-lv_root (dm-0) 253:0    0    18G  0 lvm  /
└─vg_localhost-lv_swap (dm-1) 253:1    0     2G  0 lvm  [SWAP]
sda                             8:0    0     9G  0 disk
├─sda1                          8:1    0   500M  0 part /boot
└─sda2                          8:2    0   8,5G  0 part
sr0                            11:0    1  1024M  0 rom


df -h
  /dev/mapper/vg_localhost-lv_root
                      6,5G  6,2G  256M  97% /
tmpfs                 499M  200K  499M   1% /dev/shm
/dev/sda1             485M   78M  382M  17% /boot

what am i missed?

share|improve this question
    
Did you shrink or grow the virtual disk image? And also post the output of fdisk -l and df -h. Also, did you resize the partitions and filesystem(s) accordingly? (modifyhd only changes the disk size) Are you using LVM or plain parititions? –  gertvdijk Dec 19 '12 at 15:00
    
i increased disk. The filesystem is lvm2pv the only fs that doesn't support copy option in Gparted! About fdisk and terminal note i m in gnome gui what i should try in centos to switch to console, like ALT+F1 in Fedora? –  Yurij73 Dec 19 '12 at 15:18
1  
For LVM you'll need to resize the physical volume, volume group, logical volume and filesystem subsequently. I needed to use the command line interface in GParted last time I used that for LVM. It does not explain why you're seeing application errors. Are you sure this is related? Just use your favourite terminal application within your GUI for running the commands I requested. –  gertvdijk Dec 19 '12 at 15:20
    
Looks like you missed the online-resize of the root-filesystem. –  Nils Dec 19 '12 at 22:08
add comment

2 Answers

Rather than trying to resize that existing single disk, I would create a new virtual disk image, and add that as a new physical volume to the volume group. Once the new disk in part of the volume group, you can then add that pv's capacity into the logical volume(s) you need to grow. Then, I would just grow the existing filesystem to include all of the space in the newly-expanded logical volume.

The alternative route is to create a new disk image of the size you require, mount both disk images, and dd the source to the target. Then, you can simply grow the filesystem to size. It's not the most elegant solution, but it would likely be the quick and dirty way to solve your problem.

share|improve this answer
    
which command add that pv's capacity into the logical volume(s) –  Yurij73 Dec 19 '12 at 18:09
    
lvresize allows you to enlarge an existing LV onto a new PV that was added to the volume group. –  Rob Gibson Dec 19 '12 at 18:21
add comment

First extend your VG with the new PV, then enlarge the LVs, then grow the FS on the LVs.

  • pvcreate /dev/sdb2
  • vgextend vg_localhost /dev/sdb2
  • lvresize
  • resize2fs
share|improve this answer
    
I guess this refers to the first part of the answer of Rob Gibson? You may want to improve his answer instead. –  gertvdijk Dec 19 '12 at 21:58
    
@gertvdijk the current question is "how to extend a VG". Rob answered the initial question and hinted to use a different approach instead (he got my upvote for that). –  Nils Dec 19 '12 at 22:03
    
@Nils,i added details to Q, system still use 9G instead of new 20G –  Yurij73 Dec 19 '12 at 22:08
    
@Yurij73 please add details about your root-FS (which type of FS is that) and how you tried to resize it. –  Nils Dec 19 '12 at 22:26
    
SOLVED. It was also needed do a dd from old boot partition to a new one (this part haven't be added to LV!, then i changed grub.conf to point new ) also it important for me to exclude old volumes from LV so i used vgreduce –  Yurij73 Dec 20 '12 at 14:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.