You can either convert your root volume to XFS or create a second volume. Personally, I would favour the latter as it offers more flexibility.
Option 1: Convert Root Volume to XFS
- Stop your instance (not terminate) (let's call it instance A)
- Start a new instance (let's call it instance B)
- Detach the root volume from instance A and attach it to instance B
- Create a second EBS volume, attach it to instance B
- Format the new EBS volume as XFS (install
xfsprogs if not already
- Copy all the data from the first volume to the new one (e.g. using
rsync -aHAXxSP /source /target)
- Detach the new volume from instance B and attach it as the root
volume of instance A
- Start instance A
- Terminate instance B (the original root volume should persist, keep
it around until things work to your liking).
The reason for attaching the root volume to another instance is to attain consistency, which would be difficult with the volume in use.
Option 2: Move data to a second EBS volume
- Create a second EBS volume and attach it to your instance; format it
as XFS and mount it
- Identify which directories you wish to move to the new volume (some
to consider include: /var/log, /var/lib/mysql, /var/www,
- Stop as many services as possible to remove write locks
lsof | grep /path/to/dir to check for remaining write locks
- Move the directory to the new EBS volume
- Mount bind the new directory to its old location (i.e.
mount -o bind
- Repeat for each directory
- Start your services to ensure all is working
- Edit your
/etc/fstab file to make the mount points permanent; e.g.:
/mnt/path/to/dir /orig/path/to/dir bind defaults,noatime,bind 0 0
Restart to ensure everything persists and functions as it should. You may also want to consider shrinking your root volume down a bit since, hopefully, it shouldn't be growing (or changing) much with all the data removed from it.
(As a point of mention, it may be possible to freeze an ext4 file system using
fsfreeze, which is included in