Linux Tutorials - Herong's Tutorial Examples - v1.32, by Dr. Herong Yang
"fdisk" - Format Disk Partitions
Provides a tutorial example on how to manage disks, including USB drives, partitions and formats on Linux systems.
If you want to manage partitions of storage devices like hard disks and USB drives, you need to learn how to use the "fdisk (format disk)" command as shown in this tutorial.
1. List of storage devices using "ls -l /dev/sd?" command. The "?" wildcard stands for 1 character to exclude partitions on each devices.
herong$ ls -l /dev/sd? brw-rw----. 1 root disk 8, 0 Mar 26 21:17 /dev/sda brw-rw----. 1 root disk 8, 16 Apr 4 02:25 /dev/sdb brw-rw----. 1 root disk 8, 32 Apr 4 08:02 /dev/sdc brw-------. 1 root root 8, 48 Apr 4 08:25 /dev/sdd
2. List partitions on first hard disk storage device using "fdisk -l" command. I see 5 partitions with different formats.
herong$ sudo fdisk -l /dev/sda Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x2f50ca78 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 167776255 167774208 80G 7 HPFS/NTFS/exFAT /dev/sda2 167776256 1953523711 1785747456 851.5G f W95 Ext'd (LBA) /dev/sda5 167778304 1748721663 1580943360 753.9G 7 HPFS/NTFS/exFAT /dev/sda6 1748723712 1750820863 2097152 1G 83 Linux /dev/sda7 1750822912 1953523711 202700800 96.7G 8e Linux LVM
3. List partitions on a USB storage device using "fdisk -l" command. I see one partition with W95 FAT32 format, with is compatible with Windows computers.
herong$ sudo fdisk -l /dev/sdc Disk /dev/sdc: 7.5 GiB, 8021606400 bytes, 15667200 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: 0x04030201 Device Boot Start End Sectors Size Id Type /dev/sdc1 10392 15667199 15656808 7.5G c W95 FAT32 (LBA)
Table of Contents
Cockpit - Web Portal for Administrator
"df" - Display Free Space of File System
Mount USB Drive as File System
►"fdisk" - Format Disk Partitions
"dd" - Copy Data from/to Storage Devices
Use "dd" Command to Test I/O Speed
"hdparm" - Hard Disk Parameters
"du" - Display Disk Usage of Directories
Mount Windows NTFS File System
Access Persmissions on "ntfs-3g" File System
File System Types, IDs and Formats
"parted" - Partition Manipulation Program
Reformat NTFS Partition into EXT4 Partition
Unreachable Remote File Systems
SELinux - Security-Enhanced Linux
Software Package Manager on CentOS - DNF and YUM
Running Apache Web Server (httpd) on Linux Systems
Running PHP Scripts on Linux Systems
Running MySQL Database Server on Linux Systems
Running Python Scripts on Linux Systems
vsftpd - Very Secure FTP Daemon
Postfix - Mail Transport Agent (MTA)
Dovecot - IMAP and POP3 Server
Email Client Tools - Mail User Agents (MUA)