Increasing size of an EXT3 formatted LVM Volume



Published: 2018-01-26 10:42:19 +0000
Categories: BASH,

Language

BASH

Description

This details the steps required to unmount and resize an ext3 formatted logical volume (LVM) on Linux. The steps listed are performed on Debian, but should be more or less the same for any distro.

The basic approach is more or less the same for any filesystem, though some of the tools used for resizing may vary

Snippet

# Set the following variables
#
# MOUNTPOINT - should be the path of the mount (e.g. /mnt/myfiles)
# VOL_NODE - The node of the LVM volume, will normally be /dev/[VOLGROUP NAME]/[Volume Name]
#

# Get details of the node used by the mount
mount | grep $MOUNTPOINT

# If exported via NFS, Remove it from NFS exports to unlock the mount point
nano /etc/exports 
service nfs-kernel-server restart

# Unmount the volume
umount $MOUNTPOINT

# Check how much unallocated space is in the Volume Group 
vgdisplay 

# Extend the mount by 1TB 
lvextend -L+1T $VOL_NODE

# Run a FSCK against the filesystem (otherwise resize2 will refuse to run)
e2fsck -f $VOL_NODE

# Resize the filesystem to the new size of the volume
resize2fs $VOL_NODE

# Mount again
mount $MOUNTPOINT

# Verify the new size
df -h | grep $MOUNTPOINT

# If needed, re-enable in NFS
nano /etc/exports
service nfs-kernel-server restart

Keywords

LVM, resize, expand, extend, increase, ext3, linux, extfs, resize2fs,

Latest Posts


Copyright © 2019 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and snippets.6zdgh5a5e6zpchdz.onion