Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to use free space of a partition mounted on / as volume group?

I mean creating VG on that free space, does it cause any problem?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If by mounted on / you mean, that the disk space is formatted with a file system, then no, you cannot.

An example

  • I have a disk of 500 gigs
  • I format it to contain /boot with 200 MB and / with 499.8 GB
  • I only use 10 gigs of disk space, so I have 489.8 GB free space

If that is the case, you cannot use the 489.8 GB as disk for your volume group.

However, if this is the case

  • I have a disk of 500 gigs
  • I format it to contain /boot with 200 MB and / with 100 GB, leaving me with 399.8 GB unused disk

Then I can use the 399.8 GB to create a PV in LVM and add that PV to a VG.

EDIT: Well, actually you could

I just came to think of something after I posted the answer. I was wondering if you could use loop interfaces with LVM. And it turns out you can. I am right now booting up a test box to play a little with that. I will edit this to be the results after I'm done.

EDIT: Actually - you can do it

This is basically how I did:

dd if=/dev/zero of=sflvm01.img bs=100 count=2M
dd if=/dev/zero of=sflvm02.img bs=100 count=2M

losetup /dev/loop0 sflvm01.img 
losetup /dev/loop1 sflvm02.img 

pvcreate /dev/loop0
pvcreate /dev/loop1

vgcreate test01 /dev/loop0 /dev/loop1
lvcreate -n loopdisk01 -L 300M test01
mkfs.xfs /dev/test01/loopdisk01
mkdir /mnt/428830 ; mount /dev/test01/loopdisk01 /mnt/428830

And I ended up with

/dev/mapper/test01-loopdisk01
                      296M   16M  281M   6% /mnt/428830

So, technically yes. You can do that. I would still advice you not to, though. I use LVM for all my disk.

I cannot set up the loop interfaces until my LVM has started - but when LVM starts, it cannot find the loop devices. So, I would have to do it manually at all times.

share|improve this answer
    
Really Thanks for you answer and the time you spent. –  Zim3r Sep 16 '12 at 10:23

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.