Skip to content

File System Extension

RHEL and Ubuntu

Expand the Disk Partition and Filesystem

1. SSH into the VM

2. Unmount the Disk (if necessary)

umount /dev/sdc1

3. Use parted to Resize the Partition

  • Launch parted
    parted /dev/sdc
    
  • View the current partition layout:
    (parted) print
    
  • The output should look as belows:
    Disk /dev/sdc: 215GB
    Number Start End Size File System Flags
    1      0.00B 107GB  107GB  ext4
    

4. Resize the Partition

(parted) resizepart
  • Enter the partition number (e.g., 1) and the new end size (e.g., 215GB)
    Partition number? 1
    End?  [107GB]? 215GB
    

5. Exit parted

(parted) quit

6. Check Partition Consistency

e2fsck -f /dev/sdc1

7. Resize the Filesystem

resize2fs /dev/sdc1

8. Mount the Partition

mount /dev/sdc1 /datadrive

9. Verify the Resize

df -h
  • Look for /dev/sdc1 to confirm its new size.

Extend an LV When VG Has Available Space

To extend a logical volume (LV), follow these steps:

1. Check the Current Filesystem Size

df -h /mountpoint

2. Check Available VG Space

vgs

3. Identify the LV

lsblk

4. Check Current LV Size

lvdisplay lvname

5. Extend the LV Size

  • Use -r to resize the filesystem online
lvextend -r -L +2G /dev/vgname/lvname

6. Verify the New Sizes

df -h /mountpoint

and

lvdisplay lvname

Extend a Traditional LVM Volume by Adding a New PV

To increase VG size by adding a new physical volume (PV):

1. Check Current Filesystem Size:

df -h /mountpoint

2. Verify Current PV Configuration

pvs

3. Check VG Information

vgs

4. Identify Data Disks

ls -l /dev/disk/azure/scsi1/
lsblk

5. Attach New Disk and Confirm

  • Follow instructions to attach the new disk
    ls -l /dev/disk/azure/scsi1/
    
    lsblk
    

6. Create New PV

pvcreate /dev/newdisk

7. Add New PV to VG

vgextend vgname /dev/newdisk

8. Check New VG Size

vgs

9. Extend the LV Size

lvextend -r -L +2G /dev/vgname/lvname

10. Verify the New Sizes

df -h /mountpoint

Extend a Traditional LVM Volume by Resizing an Existing PV

If you need to resize an existing disk 1. Identify Encrypted Disks

ls -l /dev/disk/azure/scsi1/
lsblk -fs

2. Check PV and VG Information

pvs
vgs
vgdisplay -v vgname

3. List Disk Sizes

for disk in `ls -l /dev/disk/azure/scsi1/* | awk -F/ '{print $NF}'` ; do echo "fdisk -l /dev/${disk} | grep ^Disk "; done | bash
lsblk -o "NAME,SIZE"

4. Check File System Utilization

df -h /datalvm*

5. Resize Data Disks

  • Follow instructions to expand the Azure managed disk.
  • Important: Deallocate the VM before resizing.

6. Restart VM and Check Sizes

or disk in `ls -l /dev/disk/azure/scsi1/* | awk -F/ '{print $NF}'` ; do echo "fdisk -l /dev/${disk} | grep ^Disk "; done | bash
lsblk -o "NAME,SIZE"

7. Check Current PV Size

pvdisplay /dev/resizeddisk

8. Resize the PV

pvresize /dev/resizeddisk

9. Verify PV Size

pvdisplay /dev/resizeddisk

10. Check VG Information

vgdisplay vgname

11. Resize the LV

lvresize -r -L +5G vgname/lvname
lvresize -r -l +100%FREE /dev/datavg/datalv01

12. Check File System Size

df -h /datalvm2

AIX

1. Identify the Filesystem: Determine the name of the filesystem associated with the directory in question.

df -gt /data/birpt/d03

Note

If the filesystem is as /dev/dbirptd03lv, then consider only dbirptd03lv

2. Locate the Volume Group (VG): Find out which Volume Group (VG) the filesystem is part of.

lslv dbirptd03lv

Note

Volume group would be shown in this output

3. Check VG Free Space: Verify the amount of free space available in the VG.

lsvg birptdatavg

Note

Check the FREE PPs: That should show the free size available on the volume group

4. Extend the Filesystem: Use the chfs command to increase the size of the filesystem.

chfs -a size=+50G /data/birpt/d03

5. Confirm the Extension: Ensure that the filesystem has been successfully extended.

df -gt /data/birpt/d03