Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

mkfs.xfs

Create an XFS file system — the default file system of RHEL.

Niveau
RHCSA-examen
Groep
Schijven en bestandssystemen
Root nodig
Ja
Pakket
xfsprogs

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

XFS is fast with large files and many parallel writers. It can grow while mounted (xfs_growfs) but can not be shrunk. The defaults are good for nearly all cases; the label (-L, max 12 characters) is the option you use most.

Zo schrijf je het

mkfs.xfs [OPTION]... DEVICE

Opties 16

Meest gebruikt

-L LABEL
Set a label (max 12 characters).
-f
Overwrite an existing file system.
-b size=N
Block size (default 4096).
-d OPTIONS
Data section, like su=,sw= for RAID stripes, agcount=N.
-i OPTIONS
Inode options (size, maxpct).
-l OPTIONS
Log (journal) options, like an external log logdev=.
-m OPTIONS
Metadata options: crc, reflink, bigtime, finobt, uuid=.
-n OPTIONS
Directory naming options.
-r OPTIONS
Realtime section.
-s size=N
Sector size.
-p FILE
Prototype file to fill the file system.
-c options=FILE
Read options from a config file.
-N
Show the settings but do not create anything.
-K
Do not discard (TRIM) blocks at creation.
-q
Quiet.
-V
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Create XFS

    mkfs.xfs /dev/vdb1

    Prints the geometry it chose.

  2. 2With a label

    mkfs.xfs -L data /dev/vdb1

    Mount with LABEL=data.

  3. 3Overwrite an old file system

    mkfs.xfs -f /dev/vdb1

    Without -f it refuses when it finds a file system.

  4. 4On a logical volume

    mkfs.xfs /dev/vgdata/lvdata

    Grow later with lvextend -r.

  5. 5Show settings without creating

    mkfs.xfs -N /dev/vdb1

    Dry run.

  6. 6Fast creation on a thin or SSD device

    mkfs.xfs -K /dev/vdb1

    Skips the discard step (faster on big devices).

  7. 7For a RAID with stripe settings

    mkfs.xfs -d su=64k,sw=4 /dev/md0

    Aligns with the RAID layout.

  8. 8Check the result

    xfs_info /dev/vdb1

    After mounting, use the mount point.

  9. 9Set the label later

    xfs_admin -L newname /dev/vdb1

    Only when not mounted.

  10. 10Remember: no shrinking

    xfs_growfs /data

    XFS grows only. Plan sizes; use ext4 when you may need to shrink.

Exitcodes

0Done.
1Error.