Extending and Shrinking Logical Partitions

(Difference between revisions)
Jump to: navigation, search
Line 4: Line 4:
 
*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 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.
 
*This method is intended for logical volumes.  We take no responsibility for anything you do with this otherwise.
 
+
*We used <tt>resize2fs</tt> for this process, but
  
 
== Overview ==
 
== Overview ==
Line 10: Line 10:
  
 
== Process ==
 
== 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 <syntaxhighlight lang="bash">
 +
resize2fs -p /dev/vg_ticc1/lv_home 200G
 +
</syntaxhighlight>
 +
#You should get a note that you need to run <syntaxhighlight lang="bash">
 +
e2fsck -f /dev/vg_ticc1/lv_home
 +
</syntaxhighlight>
 +
#Run the command.  If something goes wrong during this step, STOP.  That could be an indicator of greater disk issues.
 +
#Run the <tt>resize2fs</tt> command again.
 +
#
  
 
== References and External Links ==
 
== References and External Links ==
 
*[http://www.computers-it.com/linux/linux_lvm_resize_filesystem.php Computers-IT]
 
*[http://www.computers-it.com/linux/linux_lvm_resize_filesystem.php Computers-IT]

Revision as of 20:00, 24 April 2013

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

  1. Cut a hole in the box.
  2. 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.
  3. Run the following command
    resize2fs -p /dev/vg_ticc1/lv_home 200G
  4. You should get a note that you need to run
    e2fsck -f /dev/vg_ticc1/lv_home
  5. Run the command. If something goes wrong during this step, STOP. That could be an indicator of greater disk issues.
  6. Run the resize2fs command again.

References and External Links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox