Linux Tutorials - Herong's Tutorial Examples
∟Block Devices and Partitions
This chapter provides tutorial examples on block devices and partitions. Topics include understanding block devices, partition tables and partitions; using 'hdparm -i' command to display device information; differences between MBR and GPT partition table (disklabel) types; using 'parted' commands to manage partition table and partitions; using 'mkfs' command to format partitions; understanding 'dev/sd?' and '/dev/sd??' device files; shrinking or expanding 'ext4' file systems
These sections are omitted from this Web preview version. To view the full content,
see information on how to obtain the full version this book.
What Is Block Device
"/dev/sd?" - Block Device Files
"hdparm" - Hard Disk Parameters
Partition Table and Its Types
"parted ... mktable" - Create Partition Table
What Is Partition and Its Types
"parted ... mkpart" - Create Partition
"/dev/sd??" - Partition Device Files
File System Types, IDs and Formats
"mkfs -t ext..." - Format Partition
Shrink "ext4" File System and Partition
Expand "ext4" File System and Partition
"parted" - Partition Manipulation Program
"fdisk" - Format Disk Partitions
Takeaways:
- A block device is a data storage device that supports reading and optionally writing data in fixed-size blocks.
- A byte device is a data storage device that supports reading and writing data one byte at a time.
- "hdparm -i ..." displays identification information on the given device.
- "/dev/sd?" are device files representing block devices connected with the SCSI protocol.
- A partition table is a data structure written on a block device to record and manage multiple partitions on the block device.
- "Disklabel" refers to partition table on a block device.
- GPT (GUID Partition Table) is a newer partition table type introduced
as part of the Unified Extensible Firmware Interface (UEFI) booting process.
- MBR (Master Boot Record) is an older partition table type
introduced in MS-DOS operating systems that using the BIOS booting process.
- "Disklabel type: dos" or "Disklabel type: msdos" refers to
MBR partition table type.
- "parted ... mktable" creates a new partition table on a block device.
- "parted -l" and "fdisk -l" displays all block devices,
their partition tables and related information.
- A partition is a region of multiple continuous blocks (or sectors) managed by the partition table on a block device.
- A primary partition is a partition to store user data managed by the MBR partition table directly.
- An extended partition is a partition to be divided further into more logical partitions.
- A logical partition is a partition to store user data managed inside an extended partition.
- "parted ... print" lists all partitions in the partition table on the given device.
- "parted ... mkpart ..." creates a new partition in a partition table.
- "/dev/sd??" are device files representing partitions created on storage devices
that are connected to the Linux system using the SCSI protocol.
- "parted ... rm ..." removes an existing partition in a partition table.
- "mkfs ..." formats a given partition for the given file system type.
- "resize2fs" shrinks and expands file system's size.
- "parted resizepart" shrinks and expands partition's size, which should be
larger than its file system size.
Table of Contents
About This Book
Introduction to Linux Systems
Cockpit - Web Portal for Administrator
Process Management
Memory Management
Files and Directories
Users and Groups
File Systems
►Block Devices and Partitions
LVM (Logical Volume Manager)
Installing CentOS
SELinux - Security-Enhanced Linux
Network Connection on CentOS
Internet Networking Tools
SSH Protocol and ssh/scp Commands
Software Package Manager on CentOS - DNF and YUM
vsftpd - Very Secure FTP Daemon
LDAP (Lightweight Directory Access Protocol)
Administrative Tasks
References
Full Version in PDF/EPUB