XFS Filesystem HOWTO

From SR
Jump to: navigation, search

The XFS filesystem is recommended for drives larger than 1TB. ext3 partitions larger than 1TB can potentially take over 12 hours to fsck, and since that happens regularly after a certain amount of reboots, it's not recommended. To set up XFS on a Gentoo machine follow these steps:

First make sure you have the necessary prerequisites:

  • Compile the kernel with XFS support
hostname ~ # emerge xfsprogs 

Then, you'll need to partition the drive:

hostname ~ # parted /dev/sdb
(parted) mklabel
Warning: The existing disk label on /dev/sdb will be destroyed and all
data on this disk will be lost. Do you want to continue?
Yes/No? Yes
New disk label type?  [msdos] gpt
(parted) unit chs
(parted) mkpart
Partition name?  []? $partion_name
File system type?  [ext2]? xfs
Start? 1,0,0
End? 100%
(parted) print

Model: AMCC 9650SE-16M DISK (scsi)
Disk /dev/sdb: 790229,208,58
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 790229,255,63.  Each cylinder is 8225kB.
Partition Table: gpt

Number  Start  End            File system  Name  Flags
1      1,0,0  790229,208,25                          

(parted) quit
hostname ~ # mkfs.xfs -d su=XXk,sw=XX /dev/sdb1


Notes about the mkfs.xfs flags

'su' stands for stripe unit:

This is used to specify the stripe unit for a RAID device or a logical volume. The value has to be specified in 512-byte block units. Use the su suboption to specify the stripe unit size in bytes. This suboption ensures that data allocations will be stripe unit aligned when the current end of file is being extended and the file size is larger than 512KiB. Also inode allocations and the internal log will be stripe unit aligned.

'sw' stands for stripe width:

This is used to specify the stripe width for a RAID device or a striped logical volume. The value has to be specified in 512-byte block units. Use the sw suboption to specify the stripe width size in bytes. This suboption is required if -d sunit has been specified and it has to be a multiple of the -d sunit suboption.