Expand the root (/) filesystem by adding a new disk while ensuring system stability and minimal downtime.
Ensure data safety before making changes.
✅ Application Backup (Handled by our team)
✅ Database Backup (Handled by our team)
✅ OS Backup (Handled by the client)
Run the following commands to analyze disk usage and partitioning:
df -h
lsblk
fdisk -l
mount | grep "on / "- Confirm the current root filesystem type (ext4, XFS, etc.).
- Identify whether
/is on LVM or a standard partition.
- Identify critical services running on
/:systemctl list-units --type=service --state=running
- Inform stakeholders of any potential downtime.
- After attaching the new disk, confirm its detection:
Assume the new disk is
lsblk dmesg | tail fdisk -l/dev/sdb(adjust based on your system).
- Create a Physical Volume (PV) on the New Disk
pvcreate /dev/sdb
- Extend the Volume Group (VG)
vgextend vg_root /dev/sdb
- Extend the Logical Volume (LV)
lvextend -l +100%FREE /dev/vg_root/lv_root
- Resize the Root Filesystem
- For ext4:
resize2fs /dev/vg_root/lv_root
- For XFS:
xfs_growfs /
- For ext4:
- Verify Expansion
df -h /
⚠ This method may require a reboot and booting into a live environment.
- Check Current Partitioning Scheme
fdisk -l
- Expand the Root Partition
- Use
fdisk,parted, orgrowpart:growpart /dev/sda 1 # Adjust partition number as needed
- Use
- Resize the Filesystem
- For ext4:
resize2fs /dev/sda1
- For XFS:
xfs_growfs /
- For ext4:
- Reboot (If Required)
reboot
df -h /
lsblkRestart necessary services and validate operations:
systemctl restart <service>dmesg | tail -50
journalctl -xe- If issues arise, boot into a live environment and restore from backup.
- For LVM errors, revert changes using:
vgcfgrestore vg_root
- Run
fsckif filesystem corruption occurs.
✅ Update documentation on disk changes.
✅ Notify stakeholders that expansion is complete.
✅ Monitor disk performance over the next few days.
/(root) successfully expanded with additional disk space.- No service disruptions or data loss.