knowledge structure:
Disk basis
Detect and confirm the new disk
Planning hard disk partition
Create a file system
Mounting and unmounting file systems
(A) basic disk
Disk: Disk (Disk) memory means for storing data using magnetic recording technology. Computer disk is the main storage medium that can store large amounts of binary data after power failure and data loss can be maintained. Early computer disk using a floppy disk (soft disk, a floppy disk for short), is now commonly used disk hard disk (hard disk, referred to as hard disk).
Mechanical hard drive:
The physical structure of the hard drive
Disk: a plurality of hard disks, each disk surface 2
Head: the head on each side a
Hard disk data structures
Sector: the disk is divided into a plurality of segment areas, each sector 512 bytes of data storage
Track: the same concentric circles of different radii of the disk
Cylindrical: cylindrical surface composed of the same radius disk nowhere
Disk capacity is calculated:
Storage capacity = number of heads × tracks (cylinders) × number of sectors per track Number of bytes per sector ×
FIG 3 is a disk disk heads 6, 7 cylinders (tracks per disc 7) of the magnetic disk, FIG. 3 has 12 sectors per track, so this disk capacity:
The storage capacity of 6 * 7 * 12 * 512 = 258048
Number of sectors per track is the same as said old disk, the outer ring small density, the density of the inner ring, the amount of data stored per revolution is the same. Densities of hard disk data are consistent, so the longer the circumferential length of the track, the more sectors, the greater the amount of data stored.
Disk read response time:
Seek: time to start moving the head from the track where the data needed, the shorter the seek time, I / O operations faster average seek time is currently generally disk 3-15ms, generally about 10ms.
Rotational latency: the disk rotation data requested sectors where write head moves downward time required, depending on the disk rotational speed delay. Ordinary hard disk are generally 7200rpm, slow 5400rpm.
Data transfer time: time of transmission of the requested data needed to complete.
Summary about: From the above indicators, the most important thing, or that we should be most concerned with only two: seek time; rotational latency.
The time required to read and write information on a disk can be decomposed into: seek time, latency, transmission time. In order to improve the efficiency of disk transfer, the software should consider reducing the seek time and latency.
Block / cluster:
Outline
磁盘块/簇(虚拟出来的)。 块是操作系统中最小的逻辑存储单位。操作系统与磁盘打交道的最小单位是磁盘块。
通俗的来讲,在Windows下如NTFS等文件系统中叫做簇;在Linux下如Ext4等文件系统中叫做块(block)。每个簇或者块可以包括2、4、8、16、32、64…2的n次方个扇区。
为什么存在磁盘块?
读取方便:由于扇区的数量比较小,数目众多在寻址时比较困难,所以操作系统就将相邻的扇区组合在一起,形成一个块,再对块进行整体的操作。
分离对底层的依赖:操作系统忽略对底层物理存储结构的设计。通过虚拟出来磁盘块的概念,在系统中认为块是最小的单位。
page
操作系统经常与内存和硬盘这两种存储设备进行通信,类似于“块”的概念,都需要一种虚拟的基本单位。所以,与内存操作,是虚拟一个页的概念来作为最小单位。与硬盘打交道,就是以块为最小单位。
扇区、块/簇、page的关系
扇区: 硬盘的最小读写单元
块/簇: 是操作系统针对硬盘读写的最小单元
page: 是内存与操作系统之间操作的最小单元。
扇区 <= 块/簇 <= page
磁盘的接口类型:
IDE(并口)
SATA(串口)
SCSI
MBR与磁盘分区表示
主引导记录(MBR:Master Boot Record)
MBR位于硬盘第一个物理扇区处
MBR中包含硬盘的主引导程序和硬盘分区表
分区表有4个主分区,每个分区记录占16个字节
硬盘中的主分区数目只有4个
因此主分区和扩展分区的序号也就限制在1~4
扩展分区在分为逻辑分区
逻辑分区的序号将始终从5开始
Linux中将硬盘,分区等设备均表示为文件
文件系统类型
XFS文件系统
存放文件和目录数据的分区
高性能的日志型文件系统
Centos7系统中默认使用的文件系统
SWAP,交换文件系统
为Linux系统建立交换分区
Linux支持的其他文件系统类型
FAT16,FAT32,NTFS
EXT4,JFS
(二)检测并确认新硬盘
fdisk:查看或管理磁盘分区
fdisk -l [磁盘设备] 或 fdisk [磁盘设备]
Device:分区的设备文件名称。
Boot:是否是引导分区。若是,则有“*”标识。
Start:该分区在硬盘中的起始位置(柱面数)。
End:该分区在硬盘中的结束位置(柱面数)。
Blocks:分区的大小,以 Blocks(块)为单位,默认的块大小为 1024 字节。
Id:分区对应的系统 ID 号。83 表示 Linux 中的 XFS 分区或 EXT4 分区、8e 表示 LVM 逻 辑卷。
System:分区类型。
(三)规划硬盘中的分区
交互模式中的常用的命令
m 帮助信息
p 显示分区列表
n 创建分区
d 删除分区
t 转换分区类型 id转换
w 保存修改
q 退出
(四)创建文件系统
创建文件系统(格式化)-mkfs
mkfs -t 文件系统类型 分区设备 或 mkfs.xfs 分区设备
创建交换文件系统(格式化)-mkswap
mkswap 分区设备 swapon 分区设备 swapoff 分区设备 /proc/meminfo | grep SwapTotal 查看交换分区大小
(五)挂载,卸载文件系统-mount umount
挂载文件系统,IOS镜像到指定文件夹
mount [-t 类型] 存储设备 挂载点目录 mount -o loop ISO镜像文件 挂载点目录
卸载文件系统
umount 设备文件或者挂载点
设置文件系统自动挂载
/etc/fstab配置文件
包含需要开机后自动挂载的文件系统记录
vim /etc/fstab
/dev/sdb2:设备名称
/opt/mnt1:挂载点
xfs:文件系统类型
defaults:功能权限
0 0 not open without opening the intermediate disaster recovery check sequence starting with the distinction between the tab key or the spacebar
Refresh mount
mount -a mount refresh (auto-mount configuration file)
View disk usage
df [-hT]
"-H" option to display more readable unit of capacity
Corresponding to the type of the file system "-T" option is used to display
After the words:
Disk and file management system is crucial in Linux, it is a basis for the entry of Linux! ! !
By slightly this article hoping to help you
thanks for reading! ! !