磁盘管理:
1. 磁盘或者笔记本设备与Linux
系统的适配性 :
-
不同厂商硬件设备对
Linux
系统的支持与否,可以查看以下链接:RedHat 硬件支持 :
-
不同品牌型号笔记本对
Linux
系统的支持与否,可查看here
2. Linux
系统中的硬件设备
在Linux
系统中,硬件设备均被视为“文件”,而大部分硬件设备文件存放于目录/dev
之下。以SATA
接口的硬盘为例,硬盘的名称形式为/dev/sd[a-d]
. 另外,the linux kernel archives
的详细信息可以查看 here
另外,可以借助虚拟机创建虚拟化环境用于linux
系统的运行,虚拟化技术可以参考 Fedora Document
3. 磁盘分区
实体机器使用的磁盘名,形如/dev/sd[a-d]
, 而虚拟机环境下,可能会使用形如/dev/vd[a-p]
磁盘名,虚拟机以virtlO
接口接入磁盘时,使用virtlO
界面时,磁盘文件名形如/dev/vd[a-p]
, 而SATA/USB/SAS等磁盘接口都是使用SCSI
模块来驱动的,因此这些接口的磁盘设备名称都为/dev/sd[a-p]
的格式。根据Linux
检测到的磁盘顺序对磁盘设备加以命名。
磁盘第一个扇区存储整个磁盘重要信息,这种分区格式称为MBR(Master Boot Record)
。随着磁盘容量的增加,部分操作系统已经不能读取大于2G
的磁盘文件,因此出现了新的磁盘分区格式GPT(GUID partition table)
。
磁盘结构图示: 包括: platter/ actuator arm/disk sector/ track/ track sector/ cluster
分区表的两种格式:
MSDOS(MBR) 分区表格式:
GUID partition table, GPT 磁盘分区表
4. 磁盘操作命令
- 1.
fdisk
: Display or manipulate a disk partition table.
# fdisk --help
Usage:
fdisk [options] <disk> change partition table
fdisk [options] -l [<disk>] list partition table(s)
Display or manipulate a disk partition table.
Options:
-b, --sector-size <size> physical and logical sector size
-B, --protect-boot don't erase bootbits when creating a new label
-c, --compatibility[=<mode>] mode is 'dos' or 'nondos' (default)
-L, --color[=<when>] colorize output (auto, always or never)
colors are enabled by default
-l, --list display partitions and exit
-o, --output <list> output columns
-t, --type <type> recognize specified partition table type only
-u, --units[=<unit>] display units: 'cylinders' or 'sectors' (default)
-s, --getsz display device size in 512-byte sectors [DEPRECATED]
--bytes print SIZE in bytes rather than in human readable format
-w, --wipe <mode> wipe signatures (auto, always or never)
-W, --wipe-partitions <mode> wipe signatures from new partitions (auto, always or never)
-C, --cylinders <number> specify the number of cylinders
-H, --heads <number> specify the number of heads
-S, --sectors <number> specify the number of sectors per track
-h, --help display this help
-V, --version display version
# fdisk -l