I want to put my /usr directory onto a LVM partition if I can extend the partition while I am still using it. Is this possible? Please give me a concrete example if possible.
I have put /usr onto a LVM partition before, but when I tried to extend it the change didnt show up for df. I then copied the /usr files back to my root partition at /usr2 so that I could mke2fs -j /dev/lvmpart/usr. Naturally I wanted to make the change in space visible to df.
When I tried to remount the volume I had major problems (I was being told that the volume was already mounted...of course it wasnt but anyway...). I had copied /usr to /usr2 thinking that I would remount the extended partition and copy /usr2 back. I ultimately had to reinstall everything.
So what can I do differently this time? I believe that I have to compile the kernel with something special to be able to use mke2fs while using the partition, right?
My guess is that with /usr I have to copy the files to a larger partition and then mount that partition....but wait, doesnt that defeat the purpose of LVM? Why should I use LVM if I have to extend, unmount, mke2fs, remount (having lost any data on that partition), recopy data from a backup, and then go on my way. I want to extend and be done with it. What knowledge am I missing?
Why put just one dir on your lvm partition?
I suggest putting following on it:
You can even put your swap onto it. (I did :D)
Putting your / onto it is not recommended. But if you really want to, read this:
First you have to make sure that lvm-support is compiled into your kernel.
don't forget to install the lvm-user package
then as you said:
make your lvm-partition
mke2fs -j /dev/lvmpart/usr
making it larger:
# lvextend -L+1G /dev/lvmpart/usr (change this as neccecary)
# resize2fs -f /dev/lvmpart/usr (i'm using reiserfs and have to use resize_reiserfs)
you don't even have to unmount it!
I don't use LVM very long, but I think its great. I have a normal partition and a second harddrive that form the lvm-partition and had to extend and shrink a few things already. Everyone should use it.
|All times are GMT -5. The time now is 02:12 PM.|