% lsblk -o NAME,MODEL,SERIAL,SIZE,STATE -d
NAME    MODEL                          SERIAL             SIZE STATE
sda     HGST HDN724040ALE123           0123456789ABCDEF     3.6T running
sdb     USB Flash Drive                0123456789ABCDEF     3.7G running
nvme0n1 WDC PC SN530 SDBPNPZ-512G-1234 0123456789ABCDEF   476.9G live

Partycjonowanie

Wyczyść tablicę partycji:

% dd if=/dev/zero of=/dev/sdb bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.00297757 s, 172 kB/s

Utwórz partycję:

% fdisk /dev/sdb

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


Command (m for help): o
Created a new DOS (MBR) disklabel with disk identifier 0x997aa96e.

Command (m for help): p
Disk /dev/sdc: 7.27 GiB, 7803174912 bytes, 15240576 sectors
Disk model: DataTraveler 2.0
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: 0x997aa96e

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

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

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): 0c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

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

Formatowanie

FAT

% mkfs.vfat -F 32 -n "PQI4GB" /dev/sdb1

NTFS

% mkfs.ntfs --fast --label "PQI4GB" /dev/sdb1

XFS

% mkfs.xfs -L "PQI4GB" /dev/sdb1

Btrfs

% mkfs.btrfs -L "PQI4GB" /dev/sdb1

ext4

% mkfs.ext4 -L "PQI4GB" -m 1 -b 4096 /dev/sdb1
-m
procent przestrzeni zarezerwowanej dla roota
-b
rozmiar bloków w bajtach

More information

Tablice partycji

MBR (Master Boot Record)
tablica 32-bitowa wspierająca do 4 partycji podstawowych
GPT (GUID Partition Table)
tablica 64-bitowa, może obsłużyć do 128 partycji podstawowych

Typy partycji

% fdisk /dev/sdb

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


Command (m for help): l

00 Empty            27 Hidden NTFS Win  82 Linux swap / So  c1 DRDOS/sec (FAT-
01 FAT12            39 Plan 9           83 Linux            c4 DRDOS/sec (FAT-
02 XENIX root       3c PartitionMagic   84 OS/2 hidden or   c6 DRDOS/sec (FAT-
03 XENIX usr        40 Venix 80286      85 Linux extended   c7 Syrinx
04 FAT16 <32M       41 PPC PReP Boot    86 NTFS volume set  da Non-FS data
05 Extended         42 SFS              87 NTFS volume set  db CP/M / CTOS / .
06 FAT16            4d QNX4.x           88 Linux plaintext  de Dell Utility
07 HPFS/NTFS/exFAT  4e QNX4.x 2nd part  8e Linux LVM        df BootIt
08 AIX              4f QNX4.x 3rd part  93 Amoeba           e1 DOS access
09 AIX bootable     50 OnTrack DM       94 Amoeba BBT       e3 DOS R/O
0a OS/2 Boot Manag  51 OnTrack DM6 Aux  9f BSD/OS           e4 SpeedStor
0b W95 FAT32        52 CP/M             a0 IBM Thinkpad hi  ea Linux extended
0c W95 FAT32 (LBA)  53 OnTrack DM6 Aux  a5 FreeBSD          eb BeOS fs
0e W95 FAT16 (LBA)  54 OnTrackDM6       a6 OpenBSD          ee GPT
0f W95 Ext'd (LBA)  55 EZ-Drive         a7 NeXTSTEP         ef EFI (FAT-12/16/
10 OPUS             56 Golden Bow       a8 Darwin UFS       f0 Linux/PA-RISC b
11 Hidden FAT12     5c Priam Edisk      a9 NetBSD           f1 SpeedStor
12 Compaq diagnost  61 SpeedStor        ab Darwin boot      f4 SpeedStor
14 Hidden FAT16 <3  63 GNU HURD or Sys  af HFS / HFS+       f2 DOS secondary
16 Hidden FAT16     64 Novell Netware   b7 BSDI fs          f8 EBBR protective
17 Hidden HPFS/NTF  65 Novell Netware   b8 BSDI swap        fb VMware VMFS
18 AST SmartSleep   70 DiskSecure Mult  bb Boot Wizard hid  fc VMware VMKCORE
1b Hidden W95 FAT3  75 PC/IX            bc Acronis FAT32 L  fd Linux raid auto
1c Hidden W95 FAT3  80 Old Minix        be Solaris boot     fe LANstep
1e Hidden W95 FAT1  81 Minix / old Lin  bf Solaris          ff BBT
24 NEC DOS

Aliases:
   linux          - 83
   swap           - 82
   extended       - 05
   uefi           - EF
   raid           - FD
   lvm            - 8E
   linuxex        - 85

Command (m for help):

Refs