Building a local repo

XavorXavor Member Posts: 161
Figure hey, I'll finally setup a local repo for my puppet and kickstart builds. Turns out I miscalculated how much hard drive space I'd need for just a CentOS 6.6 and 7 ("can't be more than 40GB ..."). I used rsync to pull from a mirror to one of my virtual machines.

Watched Cap2: Winter Soldier, came back to a full hard drive. Hmm.........."rsync -avSPH --exlude="iso"..."...$H!T. I forgot the 's" and it downloaded all the ISOs. Damned typos.

So what I thought would be a fire-and-forget operation turned into "Google must tell me how to rescue disk and resize lvm NOW".

Of course the guides I read also forgot a step which ended up with more Googling because you have to activate the lv after you extend it. All this so I could setup a Spacewalk server. :/

Anyway the general steps to fix that issue is to poweroff the system and add a hard drive if your existing drive does not have spare space. Reboot with a cd/usb for CentOS into rescue mode, skip mounting the filesystem, and enter the shell.


fdisk -l #get the new hard drive location
pvcreate /dev/sdb #mine was sdb ymmv
vgextend vg_name /dev/sdb #extend the physical volume
lvdisplay #to see the number of extents available from the newly added drive
lvextend -l +4095 vg_name/lv_root #path to root lv, the plus sign is important, and -l denotes extending by physical extents
lvchange -ay /dev/vg_name/lv_root #activate the newly changed lv, which is what I did not see in the guides I found
e2fsck -f /dev/vg_repo/lv_root #check the filesystem, was required by the next step
resize2fs /dev/vg_repo/lv_root

fdisk -l to verify new space available and reboot when done

I only wrote this because, hell, it doesn't always go as fast or as well as you initially planned. I could have deleted the isos and not done the resize, but I did need the CentOS 7 isos anyway so used this as an excuse to re-visit the whole LVM commands.


  • Options
    LeBrokeLeBroke Member Posts: 490 ■■■■□□□□□□
    I'm not a huge fan of LVM, you lose everything if a single drive breaks. Why not just add a secondary drive and mount it as something like /var/www/? Or even as /secondary and then create a symlink to it?

    ln -s /secondary /var/www/centos
  • Options
    XavorXavor Member Posts: 161
    Whoops, meant to post this in the Linux+ forum (mods move pls?).

    I just added a disk to the vm because the space I needed to finish the cent 7 download was about 6 GB. So in this case I just added and extended the volume.
Sign In or Register to comment.