LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   LVM resize problem (https://www.linuxquestions.org/questions/linux-general-1/lvm-resize-problem-738622/)

tanveer 07-08-2009 10:18 AM

LVM resize problem
 
Hi,
I did an installation on my test server using LVM. Now it contains /, swap and /usr. Now they are all under LVM and /usr is 20GB, / is 10GB and swap is 2GB. Now what I knew about LVM was it automatically takes space from other LVM partitions if one gets full. So I have two question

1. If /usr gets full then will it take space from / automatically or not?
- which I didn't see happen in that system
2. If the partition table of an OS is like below which is without LVM

/ 10 GB
swap 2 GB
/var 20 GB
/usr 20 GB

Can I put this OS under LVM without destroying the os?

thanks in advance.

rayfordj 07-08-2009 11:38 AM

much speculation and assumption made on my part based on the limited information available...


Quote:

Originally Posted by tanveer (Post 3601038)
I did an installation on my test server using LVM. Now it contains /, swap and /usr. Now they are all under LVM and /usr is 20GB, / is 10GB and swap is 2GB. Now what I knew about LVM was it automatically takes space from other LVM partitions if one gets full. So I have two question

1. If /usr gets full then will it take space from / automatically or not?
- which I didn't see happen in that system

LVM does not automatically take action. It provides administrative flexibility of storage resources to dynamically allocate storage as necessary which is not easily done with traditional partitions. You may intervene and take steps to reduce a filesystem so that the allocated physical extents may then be used to extend another logical volume, but this is far from automatic and comes with its own set of risks.

Quote:

Originally Posted by tanveer (Post 3601038)
2. If the partition table of an OS is like below which is without LVM

/ 10 GB
swap 2 GB
/var 20 GB
/usr 20 GB

Can I put this OS under LVM without destroying the os?

That depends entirely on any additional available storage you might have and if the OS supports LVM. If you have consumed the entire disk it becomes more difficult than if you have 20-30GB free (unpartitioned, unformatted) space. It would likely be optimal to re-install the OS on LVM and restore data from backup. However, if you have available disk space (either on this same disk or on another disk) and are feeling up to it, you may wish to undertake the challenge. If in the above example, all partitions are primary, you are out of luck without another disk. Also, it looks like you might have /boot under / so you'll still need a non-LVM /boot partition so that GRUB may locate the necessary files to proceed with OS boot.

Short of a clean install on LVM and restore, the 2nd best would be to work from a Live-CD so that the on-disk filesystem does not have any open files to contend with. While shoveling the data around is not itself difficult, you'll need to be sure to make all the necessary modifications elsewhere in the OS to ensure that it knows now where to look for things. This is where it may become troublesome.

examples:
- grub.conf will need to be modified to provide correct root= location to kernel.
- fstab will need to be updated to reflect new device names to mount locations mappings
- initrd will need to include necessary LVM information


I really have more questions than answers at this point based on such limited information. I'm sure we could dig up dozens of guides and HOW-TOs that discuss and demonstrate examples similar to what you are asking. While I am not saying it is impossible to do, I am -- at least at this time -- saying that it might not be worth the headache to you...



:study:


All times are GMT -5. The time now is 10:51 AM.