Extending and Shrinking Logical Partitions
From Physiki
We found out that the way our parititions were originally was that we did not have enough space for the root partition and more than enough on our home. Since we're using LVMs, we needed to resize those, preferably with everything running and without losing data.
Contents |
Important Notes
- This messes with your logical volumes. This can damage your data if you do it incorrectly or if you do not take proper precautions. BACK UP YOUR DATA!
- This method is intended for logical volumes. We take no responsibility for anything you do with this otherwise.
- We used resize2fs for this process, but
Overview
What this method does is shrink one partition (say, /home), and expand another (/, for instance). With LVMs, this becomes a matter of shrinking the filesystem on the volume and then the volume itself. Afterwards, when you want to expand the other partition, you do the same process in reverse, you increase the volume size and then increase the filesystem to fill the new volume.
Process
- Cut a hole in the box.
- Unmount the partition you're about to shrink. If you're trying to do this to something like /, then you're going to need to do it from a live-cd or different installation.
- Run the following command
resize2fs -p /dev/vg_ticc1/lv_home 200G
- You should get a note that you need to run
e2fsck -f /dev/vg_ticc1/lv_home
- Run the command. If something goes wrong during this step, STOP. That could be an indicator of greater disk issues.
- Run the resize2fs command again.