LVM Resize a Filesystem: Difference between revisions

From UNIX Systems Administration
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== AIX ==
== AIX ==
=== Extend a Filesystem ===
==== Extend a Filesystem ====
# <tt>'''# chfs -a size=+<additional size>M <absolute path to filesystem>'''</tt>
# <tt>'''# chfs -a size=+<additional size>M <absolute path to filesystem>'''</tt>
=== Reduce a Filesystem ===
==== Reduce a Filesystem ====
# <tt>'''# chfs -a size=-<reduced size>M <absolute path to filesystem>'''</tt>
# <tt>'''# chfs -a size=-<reduced size>M <absolute path to filesystem>'''</tt>


== Linux ==
== Linux ==
=== Extend a Filesystem ===
==== Extend a Filesystem ====
# <tt>'''# lvextend -L +<size in MB>M /dev/rootvg/<logical volume>'''</tt>
# <tt>'''# lvextend -L +<size in MB>M /dev/rootvg/<logical volume>'''</tt>
# <tt>'''# resize2fs /dev/<volume group>/<logical volume>'''</tt>
# <tt>'''# resize2fs /dev/<volume group>/<logical volume>'''</tt>
=== Reduce a Filesystem ===
==== Reduce a Filesystem ====
# Note: You may have to change to runlevel 1 in order to unmount.
# Note: You may have to change to runlevel 1 in order to unmount.
# Backup your data!
# Backup your data!

Revision as of 18:35, 1 March 2017

AIX

Extend a Filesystem

  1. # chfs -a size=+<additional size>M <absolute path to filesystem>

Reduce a Filesystem

  1. # chfs -a size=-<reduced size>M <absolute path to filesystem>

Linux

Extend a Filesystem

  1. # lvextend -L +<size in MB>M /dev/rootvg/<logical volume>
  2. # resize2fs /dev/<volume group>/<logical volume>

Reduce a Filesystem

  1. Note: You may have to change to runlevel 1 in order to unmount.
  2. Backup your data!
  3. Dismount the filesystem before reducing the size.
    # umount /dev/<volume group>/<logical volume>
  4. Force check the filesystem to ensure it is clean. DO NOT RUN e2fsck IF THE FILESYSTEM IS MOUNTED.
    # e2fsck –f /dev/<volume group>/<logical volume>
  5. Reduce the filesystem.
    # resize2fs /dev/<volume group>/<logical volume> [+ | -]<size in MB>M
  6. Reduce the logical volume.
    # lvreduce –L -<size in MB>M /dev/<volume group>/<logical volume>
  7. Re-check the filesystem to ensure it is clean.
    # e2fsck –f /dev/<volume group>/<logical volume>
  8. Mount the filesystem.
    # mount /dev/<volume group>/<logical volume>

Further Reading

  1. IBM pSeries and AIX Information Center