Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one Volume Group (named system) with 2 Logical volumes (/dev/system/swap and /dev/system/root) in one Physical volume (/dev/sda2) .

I want to add one more hard disk to that VG that will extend the size of directory /opt/splunk/lib. It has had already data inside.

So how can i do to use totally the new hard disk for that directory and move data from original LV to new LV that is created from the new hard disk ?


share|improve this question
up vote 1 down vote accepted

Ok- First, if you add a second hard disk to a existing volume group, you take a big risk: any disks failure from that volume group will make all logical volume go unavailable. You will also not have any of the added benefit such as stripping. You would have to add a raid array (+2 drives minium, for raid 5), to see at least some kind of benefit.

The only reason why you would want to add a drive to an existing volume group is if you would like to extend a specific partition. In the present case, you want to add a new one (give all the space to /opt/splunk/lib).

I would suggest you do the following:

  • Identify the new HD (for the rest of the walkthrough, I'll take for granted you found /dev/sdb):

    ls /dev/sd*

  • Create a new partition on the drive (could also use the whole device and jump that step)

    fdisk /dev/sdb ; New, Primary, ID:1, from Start, to End ; Write

  • Create a new physical volume

    pvcreate /dev/sdb1

  • Create a new volume group

    vgcreate splunk /dev/sdb1

  • Create a new logical volume (size 100gb, named splunk_lib, from the splunk volume group)

    lvcreate -l 100g -n splunk_lib splunk

  • Create a file system on the new logical volume

    mkfs.ext4 /dev/splunk/splunk_lib

  • Create a mount point & Mount the new filesystem

    mkdir /tmp/splunk_lib mount /dev/splunk/splunk_lib /tmp/splunk_lib

  • Stop splunk, sync lib directory

    rsync -avz /opt/splunk/lib/* /tmp/splunk_lib/.

  • Unmount, move and remount

    umount /tmp/splunk_lib ; mv /opt/splunk/lib /opt/splunk/old-lib; mkdir /opt/splunk/lib ; mount /dev/splunk/splunk_lib /opt/splunk/lib

  • Don't forget to add it to /etc/fstab (to be up at next reboot)

    vi /etc/fstab or nano /etc/fstab

  • Start splunk.

share|improve this answer
Thank you so much, i get rid of my headache today :)) – SieuTruc Nov 13 '12 at 23:02

Your Answer


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.