USB-Stick unter Linux partitionieren und formatieren

Aufgrund der Größenrestriktionen von FAT und FAT32 verwende ich für meine USB-Sticks unter Linux meist ein Ext4-Dateisystem.
Damit ist es mir möglich z.B. Images von der ganzen SD-Karte eines Raspberry Pi zu erstellen. Eine Anleitung dazu gibt es hier.

Wir verwenden dazu fdisk und mkfs.ext4 welche standardmässig bei jeder Debian-Installation dabei sind.

Erstellen einer Linux-Partition

Im ersten Schritt löschen wir die bestehende FAT oder FAT32 Partition und erstellen eine neue Linux-Partition.

Wir rufen fdisk mit dem Pfad des Laufwerks auf und werden mit der Programmversion und einem Warnhinweis begrüßt:

root@rpitest:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Nun drücken wir p (print) um die Partition des Laufwerks anzuzeigen:

Command (m for help): p
Disk /dev/sda: 14.3 GiB, 15376000000 bytes, 30031250 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1          32 30031249 30031218 14.3G  c W95 FAT32 (LBA)

Wir löschen die bestehende FAT32-Partition mit d (delete):

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Nun erstellen wir eine neue Linux-Partition mit n (new) und verwenden die default-Werte:

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 
Partition number (1-4, default 1): 
First sector (2048-30031249, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-30031249, default 30031249):

Created a new partition 1 of type 'Linux' and of size 14.3 GiB.

Mit w (write) schreiben wir die neue Partition auf das Laufwerk:

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Wir haben die FAT32-Partition gelöscht, eine Linux-Partition erstellt und müssen den USB-Stick noch formatieren.

Formatieren mit Ext4-Dateisystem

Wir rufen mkfs.ext4 mit der Partitionsbezeichnung auf:

root@rpitest:~# mkfs.ext4 /dev/sda1
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 3753650 4k blocks and 940240 inodes
Filesystem UUID: 395acbfe-b827-4b91-a1c2-c7f4eec05c65
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

Der USB-Stick ist nun fertig formatiert und kann unter Linux normal verwendet werden.

Windows kann jedoch kein Ext4-Dateisystem lesen und wird mit folgender Meldung kommen: