I have a LVM2 need and am confused.
I have just completed building a test system. It has a boot area (kernel) and a LVM2 volume.
I would like to reduce the size of the LVM2 volume to add a swap partition to the system. I have found lots of information of growing but the info on reduction is very confusing. I am lost and am appealing. I saw this, but found that the problem being addressed does not match mine.
Here's my single drive system info. And, I would like to have a 16GB Swap partition.
What does "swapon -s" show ?. I suspect you'll find no (technical) need to allocate swap outside of LVM.
Request if backup in place
BACKUP is not a problem. I OK on this. But, maybe a recommendation on how I should proceed. What should I designate to reduce? And which toolset? I venturing into a new world of reduction. GParted is not a help.
Are you ok with a swap file? You need to be root to do this.
Create a 16GB file:
dd if=/dev/zero of=/swapfile_01 bs=1M count=16000
Add the following line at the bottom of your /etc/fstab so the file will load as a swapfile when you reboot.
/swapfile_01 swap swap defaults 0 0
Reducing the size of ext3 file systems didn't always go well for me in the past. It's doable but do you REALLLY need it?
Why do you need the added swap? If you do a free and look at the cached, buffers and free that's what your processes will use (ie apps). The used memory is a cache of your disk so if you need to read from it, the reads will be faster.
total used free shared buffers cached
Mem: 3763 3612 150 0 0 3422
-/+ buffers/cache: 189 3573
Swap: 0 0 0
If you still want to try resizing here's a page that's a nice read:
Oh one more thing. It took me 7.5 minutes to create a 16GB file on a 2nd gen 40GB SSD. I'm assuming it'll take you a lot longer.
You didn't answer my question.
Thanks but i really want to reduce the LVM2
Thanks for the assistance thus far.
But, I really want help reducing the LVM such that it ends with 16GB of free space. Then, I can use GParted to make the free space a SWAP partition.
So the help I need is understanding on how to go about
Use the Nancy Reagan method...
...just say No!
I just went through a good deal of research on reducing an LVM2 VG/LV, as an exercise (I had installed CentOS with 'defaults' and it does a big LVM on the whole disk). I wanted to gain experience with LVM so I thought I'd try it. I have a fair amount of Linux experience as well as other OS'es and I can tell you it is *possible* to do it but only if you are absolutely desperate.
Long story short, I searched LQ, CentOS.org, and many other sites for LVM info (tldp.org LVM-HOWTO, and Redhat Mag LVM2/resize fs, and some others) and had a plan to do it, until I got to the 'pvresize' step. The PE's were spread out over the whole disk and while they (apparently) can be moved, it's a bear. I did not continue as this was just a learning exercise.
So unless you have no other choice, I'd suggest you make another choice. If you want to do it as a learning tool, on a test system, by all means give it a try!
I have a new system with little to no data that cannot be recreated. I don't think I have any PEs that are scattered about as you have.
Did you find a paper or a solution that led you to try this? I like to use it if you can point me to one.
There's lots of experiences on increasing, but the reductions seemingly are very lacking.
If anyone has any solutions tucked away or any knowledge I'll give it a run. I had hope that I could publish something with Pics for others to use as a guide for how to reduce a single drive system where the LVM has consumed the total drive. And, like me, they would want to reduce it for a good reason.
Thanks for any help.
Reduce VG size - Reduce LVM2 size for drive free space
Found it! Looks like this will do the trick. but, there appears to be some confusion on the final step for creating the free space.
Does anyone know if the pvreduce (physical volume) will leave an open free space area on the drive?
Thanks in advance, if you know the answer.
|All times are GMT -5. The time now is 05:46 PM.|