Assuming pg1 is our current primary node and /dev/VG_POSTGRES/LV_DATA is the device we formatted with XFS, follow these steps there as the root user:
- Examine the current fragmentation status with this command:
xfs_db -f -c frag /dev/VG_POSTGRES/LV_DATA
- Defragment the filesystem with xfs_fsr:
xfs_fsr -t 600 /dev/VG_POSTGRES/LV_DATA
- View the real-time fragmentation status afterwards:
xfs_db -f -c frag -r /dev/VG_POSTGRES/LV_DATA