On Friday 16 December 2011 03:18:16 Allan Gottlieb wrote:
> I need to add space to /var (thank you, libreoffice), which is on lvm.
> Since my one volume group vg is getting low, I thought this would be a
> good time to extend it as well.

Actually, you need space in /var/tmp/portage

> Alan (McKinnon) has posted very helpful lvm bits (reprinted below).
> Following alan's bottom up creation mandate I believe the idea is
> 
> phy disk:   /dev/sda  my only drive
> phy part:   fdisk   create another partition of type LVM (/dev/sda8)
> phy vol:    pvcreate /dev/sda8
> vol grp:    vgextend vg /dev/sda8
> log vol:    lvextend --size +10G /dev/vg/var
> file sys:   resize2fs /dev/vg/var
> files/dirs: not relevant
> 
> Questions
> 
> 1.  Apparently 2.6 (hence 3.x) kernels can expand mounted file systems
>     (/var is mounted as ext3).
> 
>     Since I can't unmount /var because it is in use, I guess that, if I
>     every need to shrink /var, I would need to boot off a CD.  Is that
>     correct?

For shrinking, you need to umount the partition first. Online-resizing only 
works when increasing the size.

>     Back in the day, we had single user mode for this, but I don't see
>     how to get the equivalent now.

"rc single" (See Dales email)

>     Is it really safe to extend /var (i.e., /dev/vg/var) while mounted
>     as ext3?  It sounds frightening since daemons could start running
>     and access /var.

Yes, I regularly extend filesystems while already copying data to them.

> 2.  Since currently /var is entirely from /dev/sda7 (my original lvm
>     partition) should I use the optional parameter to lvextend to
>     force the new space for /var to come from there as well?
>         lv extend --size +10G /dev/sda7

No, LVM can assign space from any disk. It will know where to go when 
accessing it.

If it's just temporary for LibreOffice, I'd suggest making a temporary LV, 
mount 
it at /var/tmp/portage and then emerging the software.
Then when finished, umount and remove the LV.

I see no need to have /var really large for normal use and have never tried 
shrinking filesystems myself.

> thanks in advance

Your welcome :)

HTH,

--
Joost

Reply via email to