You must migrate a filesystem from ext4 to XFS on a live system. What is your plan?
AdvancedScenarioStorage, disks and filesystems
Answer
Situation read → There is no in-place conversion; you copy data to a new filesystem.
What I'd do →
- Create a new LV or disk and format XFS.
- Pre-copy with
rsync -aHAXS --numeric-ids /data/ /newdata/. - Stop writers, final rsync with
--delete. - Swap mount points in fstab (by UUID) and mount.
- Restore SELinux contexts, start services, verify, keep the old volume read-only for rollback.
Why → -H keeps hardlinks, -A ACLs, -X xattrs (SELinux labels), -S sparse files: all things plain cp can lose.
Interview tip → Mention that XFS can't shrink, so size it right.
More on Storage, disks and filesystems
You get paged at 3 AM: the root filesystem on a production server is at 98% and climbing. Walk through your response.BeginnerA new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?BeginnerThe `/var` LVM logical volume is nearly full and there is free space in the volume group. How do you grow it online?BeginnerThe volume group has no free space. You've been given a new disk. How do you add it to grow `/var`?IntermediateA cloud VM's root disk was enlarged from 30 GB to 80 GB in the console, but `df` still shows 30 GB. What do you do?BeginnerYou need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.Intermediate