How to enlarge home dir. -

Richard Shaw hobbes1069 at gmail.com
Thu May 5 19:12:50 UTC 2011


On Thu, May 5, 2011 at 1:45 PM, Bob Goodwin <bobgoodwin at wildblue.net> wrote:
> .
> This computer is giving me fits because the home directory is overloaded.
>
>    [bobg at box9 ~]$ df
>    Filesystem           1K-blocks      Used Available Use% Mounted on
>    /dev/mapper/vg_box9-lv_root
>                           46703584   8460264  35870920  20% /
>    tmpfs                  1543956       388   1543568   1% /dev/shm
>    /dev/sdc2               495844     66800    403444  15% /boot
>    /dev/mapper/vg_box9-lv_home
>                           45251640  42600112    352856 100% /home
>    192.168.1.48:/mnt/rfg/
>                          721061760  40920288 643513664   6% /mnt/srvr1
>    192.168.1.48:/mnt/glg/
>                          721061760  40920288 643513664   6% /mnt/srvr2
>
> There are 3 hard drives, apparently only one is being used, /dev/sdc, a
> 40 gig drive shared with a Windows partition. There are also 2 80 gig
> drives, one has nothing on it but an LVM partiton:
>
>    Disk /dev/sdb: 80.0 GB, 80000000000 bytes
>    255 heads, 63 sectors/track, 9726 cylinders, total 156250000 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: 0xd0f4738c
>
>        Device Boot      Start         End      Blocks   Id  System
>    /dev/sdb1            2048   156248063    78123008   8e  Linux LVM
>
> How do I get /dev/sdb1 added to the system?
>
> This is probably the result of swapping drives from a defunct computer
> into this one several months ago. I have been telling myself that I'll
> just do a new install when F-15 comes out but it looks like I need to
> fix the problem now.
>
> What do I need to do?

Of course there's about 50 ways to do something about this but as long
as you don't care about data reliabilty, the easiest thing would be to
make the 80gb drive part of your existing "vg_box9" volume group. Add
some of all of the extents to your "lv_home" logical volume and then
resize your partition to fill the LV.

Keep in mind, if one of the two drives go bad you'll probably loose
all of /home so caveat emptor applies.

The 80gb LVM drive may or may not already have a volume group (VG)
associated with it, if so you might have to add "-f" to vgextend.

First you need to add /dev/sb1 to your volume group, i.e.:

vgextend -f vg_box9 /dev/sdb1

but I would try without the -f first and see if it complains.

Then you need to expand your "lv_home" logical volume over /dev/sdb1.

lvextend /dev/vg_box9/lv_home /dev/sdb1

This is a short cut to have lv_home use all of /dev/sdb1, usually you
would have to tell it how much of the vg you want to use but if you
specify the device it uses all of it.

If your brave enough to let it call resizefs for you, add the '-r' option.

You didn't say what the underlying file system is so you need to know
if it supports online resizing or not. If not then you need to boot a
live CD/USB stick although going into single user mode would probably
let you unmount /home as well.

I hope this helps but as usual, no warranty on the results and be sure
to backup anything critical.

Richard


More information about the users mailing list