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.ext4

Create an ext4 (or ext3/ext2) file system.

Niveau
RHCSA-examen
Groep
Schijven en bestandssystemen
Root nodig
Ja
Pakket
e2fsprogs
Ook
mke2fs, mkfs.ext3, mkfs.ext2

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

Wat het doet

mkfs.ext4 is mke2fs -t ext4. ext4 can grow (also mounted) and shrink (only unmounted) with resize2fs. By default 5 % of the blocks are reserved for root (-m), so root can still work when users fill the disk.

Zo schrijf je het

mkfs.ext4 [OPTION]... DEVICE [SIZE]

Opties 30

Meest gebruikt

-L LABEL
Set a label (max 16 characters).
-m PERCENT
Reserved blocks for root (default 5).
-t TYPE
ext2, ext3 or ext4 (with mke2fs).
-T USAGE
Usage type from mke2fs.conf: news, largefile, largefile4, small, floppy.
-b SIZE
Block size (1024, 2048, 4096).
-i BYTES
Bytes per inode (smaller = more inodes).
-N NUMBER
Number of inodes.
-I SIZE
Inode size.
-U UUID
Set the UUID.
-O FEATURES
Turn features on or off (^feature = off), like ^has_journal.
-E OPTIONS
Extended options: stride=, stripe_width=, lazy_itable_init=, nodiscard …
-j
Create a journal (ext3).
-J OPTIONS
Journal options (size=, device=).
-e continue|remount-ro|panic
What to do on errors.
-c
Check for bad blocks first.
-l FILE
Read bad blocks from a file.
-g N, -G N
Blocks per group / groups per flex group.
-C SIZE
Cluster size (bigalloc).
-d DIR
Copy this folder into the new file system.
-M DIR
Last mounted directory.
-o OS
Creator OS.
-r REVISION
File system revision.
-S
Write only superblock and group descriptors (rescue, dangerous).
-D
Use direct I/O.
-z FILE
Save an undo file.
-n
Dry run: show what would happen.
-F
Force.
-q
Quiet.
-v
Verbose.
-V
Show the version.

Voorbeelden 10

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

  1. 1Create ext4

    mkfs.ext4 /dev/vdb2

    Asks before overwriting an existing file system.

  2. 2With a label

    mkfs.ext4 -L backup /dev/vdb2

    Mount with LABEL=backup.

  3. 3Less reserved space on a data disk

    mkfs.ext4 -m 1 /dev/vdb2

    1 % instead of 5 % (big disks waste a lot with 5 %).

  4. 4Many small files

    mkfs.ext4 -T small /dev/vdb2

    More inodes (mail or cache folders).

  5. 5Large files only

    mkfs.ext4 -T largefile4 /dev/vdb2

    Fewer inodes, more space for data.

  6. 6Dry run

    mkfs.ext4 -n /dev/vdb2

    Shows the backup superblock positions — useful for repair.

  7. 7ext3 or ext2

    mke2fs -t ext3 /dev/vdb3

    Older formats, for old systems.

  8. 8Fast create on big devices

    mkfs.ext4 -E lazy_itable_init=1,nodiscard /dev/vdb2

    Finishes the inode tables in the background.

  9. 9Check the result

    dumpe2fs -h /dev/vdb2 | grep -E 'volume name|Reserved block|Inode count'

    Settings of the new file system.

  10. 10Change settings later

    tune2fs -m 1 -L data2 /dev/vdb2

    No need to recreate.

Bestanden

/etc/mke2fs.conf
Defaults and usage types.

Exitcodes

0 :: Done. 1 :: Error.