Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
mkfs -t TYPE DEVICE calls the program mkfs.TYPE. On RHEL the main types are xfs (default), ext4 and vfat. All options after the type go to that program. Creating a file system deletes everything that was on the device.
Zo schrijf je het
mkfs [-t TYPE] [FS-OPTIONS] DEVICE [SIZE]Opties 5
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1XFS file system
mkfs -t xfs /dev/vdb1Same as
mkfs.xfs /dev/vdb1.2ext4 with a label
mkfs -t ext4 -L backup /dev/vdb2The label goes to mkfs.ext4.
3Which mkfs programs exist?
ls /usr/sbin/mkfs.*The types you can use.
4Check the disk first
lsblk -f /dev/vdbMake sure the partition is empty or not needed.
5FAT for a USB stick
mkfs -t vfat -n USBKEY /dev/sdc1Readable on Windows and macOS.
6On an LVM logical volume
mkfs -t xfs /dev/vgdata/lvwebSame as on a partition.
7See what would be run
mkfs -V -t ext4 /dev/vdb2Prints the real command.
8Overwrite an old file system
mkfs -t xfs -f /dev/vdb1mkfs.xfs needs -f when it finds an old file system.
9Remove old signatures first
wipefs -a /dev/vdb1; mkfs -t xfs /dev/vdb1Clean start.
10Check the result
blkid /dev/vdb1Shows TYPE and the new UUID.
Niets past bij dit filter.
Let op
- Without -t, mkfs creates ext2. Always give the type.
- The wrong device = lost data. Check with lsblk -f.
Exitcodes
0 :: Done. 1 :: Error.