Disk and file management system (consolidation theory, Reprinted with authorization)

A disk base

Second, to detect and confirm the new hard drive

Third, the hard disk partition plan

Fourth, create a file system

Fifth, mounting and unmounting file systems

First, the physical structure of the hard disk

 disk: a plurality of hard disks, each disk 2 side
 head: a magnetic head on each side
 disk data structures
 sector: the disk is divided into a plurality of segment areas, storing 512 bytes per sector The data.
 track: the same concentric circles with different radii of the disk
 Cylindrical: cylindrical surface of different radius of the disk the same configuration
the TIP: mechanical hard disk (u disk coming out of the cloud in the future will replace the disk u disk storage)

FIG disk structure as
■ hard disk storage capacity x = number of heads tracks (cylinders) x the number of sectors per track number x
the number of bytes per sector
■ may be cylinder / head / sector area unique to each positioning disk
■ disk Interface type 
● IDE (parallel): Hd ● SATA (serial) ● SCSl: sd
Disk and file management system (consolidation theory, Reprinted with authorization)

Second, to detect and confirm the new hard drive

 generally have a plurality of hard disks, each disk comprising two surfaces, each disk will have a read / write head correspondingly. Limited overall size and production cost of the hard disk, the number of the disk are restricted, generally less than 5. Upwardly from the lower disc numbered from zero, as the lowermost surface of disk 0 and has a surface, and then on to a disc number 3 and the second surface plane.
 cylinder composed of a plurality of tracks, sector is the smallest part of the disk, typically 512 bytes.
Disk and file management system (consolidation theory, Reprinted with authorization)

1.Page: minimum memory units described
2 sector: minimum unit disk
. 3 blocks: the smallest unit of a hard disk for the operating system to read and write
. 4 sector <= Block / Cluster <= Page

Third, the hard disk partition plan

MBR与磁盘分区表示
■主引导记录(MBR: Master Boot Record)
●MBR位于硬盘第一个物理扇区处
●MBR中包含硬盘的主引导程序和硬盘分区表
●分区表有4个分区记录区,每个分区记录区占16个字节■Linux中将硬盘、分区等设备均表示为文件
Disk and file management system (consolidation theory, Reprinted with authorization)

磁盘分区结构
■硬盘中的主分区数目只有4个
■因此主分区和扩展分区的序号也就限制在1 ~4
■扩展分区再分为逻辑分区(逻辑分区建立在扩展分区之上)
■逻辑分区的序号将始终从5开始
Disk and file management system (consolidation theory, Reprinted with authorization)

文件系统类型
1.XFS文件系统  
●存放文件和目录数据的分区
●高性能的日志型文件系统
●CentOS 7系统中默认使用的文件系统
2.SWAP,交换文件系统
●为Linux系统建立交换分区
3.Linux支持的其它文件系统类型
●FAT16、 FAT32、 NTFS
●EXT4、 JFS ......

fdisk命令
查看或管理磁盘分区
fdisk -l 磁盘设备
或fdisk 磁盘设备

交互模式中的常用指令
m :帮助信息
P :显示分区列表
n :创建分区
d :删除分区
t :转换分区类型(通过ID)
w :保存修改
q :退出

四、创建文件系统

1.mkfs
Make filesystem,创建文件系统(格式化)
mkfs -t 文件系统类型 分区设备
Disk and file management system (consolidation theory, Reprinted with authorization)

2.mkswap命令
make swap ,创建交换文件系统
mkswap 分区设备
Disk and file management system (consolidation theory, Reprinted with authorization)

3.添加分区空间
Swapon:增加分区的空间;
Swapoff:减少分区的空间。

五、挂载、卸载命令

1.mount命令
挂载文件系统、ISO镜像到指定文件夹
mount 【-t 类型】 存储设备 挂载点目录
mount -o loop ISO镜像文件 挂载点目录
2.umount命令
卸载已挂载的文件系统
umount 存储设备位置
umount 挂载点目录

Ø 3. Format
mkfs [options]
-V: detailed display mode
-t: a given type of file system, Linux ext2 preset value
as two inputs are correct (whichever)
Disk and file management system (consolidation theory, Reprinted with authorization)

Ø 4. Set file system is automatically mounted
 / etc / fstab profile
example:
O: / dev / SR0 / mnt ISO9660 Defaults 0 0
/ dev / SR0: device name
/ mnt mount point
iso9660: file system type
defaults: function or authority (rw, ro, exec, noexec , default)
on whether a 0 for disaster recovery kump;
the second is to start 0 check sequence (0,1,2, we improve work efficiency, do not usually choose 0 check)

5.Mount -a automatically mount
 means the entire contents of / etc / fstab reload
mount can display the contents of / etc / fstab inside.
But this thing has been mounted at boot time, and if you do not modify the fstab adding new things there is certainly no output. mount -a will ignore all operations have been completed, that is, after the boot fstab has been mounted, and you do not have to modify fstab. You then run mount -a, he will automatically ignore all fstab content.

The main master disk management partition, format and methods of using the mount command, the next issue will focus my little friends come to share LVM logical volumes (physical volumes, volume groups, logical volumes) of the commands.

Guess you like

Origin blog.51cto.com/14475593/2430455