XFS: Difference between revisions

From Leo's Notes
This page was last edited on 2 January 2022, at 00:48.
Initial Content
 
No edit summary
Line 14: Line 14:
|<code>xfs_check $device</code>
|<code>xfs_check $device</code>
|<code>xfs_check /</code>
|<code>xfs_check /</code>
|-
|Defragment a XFS filesystem
|<code>xfs_fsr</code>
|<code>xfs_fsr /</code>
|-
|-
|Resize a XFS filesystem
|Resize a XFS filesystem
Line 27: Line 31:
|<code>xfsrestore -f /backup-home.data /dev/mapper/vg_lv</code>
|<code>xfsrestore -f /backup-home.data /dev/mapper/vg_lv</code>
|}
|}
== Tasks ==
=== Growing a filesystem ===
Use <code>xfs_growfs</code> to expand a XFS filesystem to its maximum size of its underlying partition or device. This can be done while the filesystem is online.
{{Highlight
| code = # resize2fs /dev/mapper/cl_hpcmonitor-metrics
resize2fs 1.45.4 (23-Sep-2019)
Filesystem at /dev/mapper/cl_hpcmonitor-metrics is mounted on /var/metrics; on-line resizing required
old_desc_blocks = 83, new_desc_blocks = 89
The filesystem on /dev/mapper/cl_hpcmonitor-metrics is now 186122240 (4k) blocks long.
| lang = terminal
}}
=== Shrinking a filesystem ===
You can't. You need to destroy and recreate the filesystem. You can use <code>xfsdump</code> and <code>xfsrestore</code> to help with this.


== See also ==
== See also ==


* https://linux.die.net/man/8/xfsdump
* https://linux.die.net/man/8/xfsdump

Revision as of 00:48, 2 January 2022

XFS is a high performance filesystem.

Cheatsheet

Description Command Example
Create a XFS filesystem mkfs.xfs $device mkfs.xfs /dev/sda1
Check XFS filesystem xfs_check $device xfs_check /
Defragment a XFS filesystem xfs_fsr xfs_fsr /
Resize a XFS filesystem xfs_growfs $mount xfs_growfs /
Creates a XFS filesystem dump into a file xfsdump xfsdump -l 0 -f /backup-home.data /dev/mapper/vg_lv
Restore a XFS filesystem from a dump xfsrestore xfsrestore -f /backup-home.data /dev/mapper/vg_lv

Tasks

Growing a filesystem

Use xfs_growfs to expand a XFS filesystem to its maximum size of its underlying partition or device. This can be done while the filesystem is online.

# resize2fs /dev/mapper/cl_hpcmonitor-metrics
resize2fs 1.45.4 (23-Sep-2019)
Filesystem at /dev/mapper/cl_hpcmonitor-metrics is mounted on /var/metrics; on-line resizing required
old_desc_blocks = 83, new_desc_blocks = 89
The filesystem on /dev/mapper/cl_hpcmonitor-metrics is now 186122240 (4k) blocks long.

Shrinking a filesystem

You can't. You need to destroy and recreate the filesystem. You can use xfsdump and xfsrestore to help with this.

See also