当前位置:网站首页>Disk management and file systems
Disk management and file systems
2022-08-05 06:15:00 【sologuai】
一、磁盘概述
Three elements of disk physics:
扇区:盘片被分为多个扇形区域,每个扇区存放512字节的数据,硬盘的最小存储单位
磁道: 同一盘片不同半径的同心圆, 是由磁头在盘片表面划出的圆形轨迹,方便数据存储
柱面: 不同盘片相同半径构成的圆柱面,由同一半径圆的多个磁道组成
二、mbr
- MBR位于硬盘第一个物理扇区处 , MBR中包含硬盘的主引导程序和硬盘分区表
- 第一个扇区总共512字节,前446字节是主引导记录,分区表保存在扇区中的第447-512字节中.
- 分区表有4个分区记录区,每个分区记录区占16字节.
- The last two bytes are the flag bits
表示:/dev/hda5
- /dev/:硬件设备文件所在的目录
- hd:表示IDE设备(sd表示scsi设备)
- a:硬盘的顺序号,表示的第几块硬盘,以a、b、c…表示
- 5:分区的顺序号,表示第一块硬盘接口的第五个分区
磁盘分区结构
- 硬盘中的主分区数目只有4个
- 主分区和扩展分区的序号限制在1 ~4
- 扩展分区再分为逻辑分区
- 逻辑分区的序号将始终从5开始
三、Linux中使用的文件系统类型
- XFS文件系统
- Swap交换文件系统 (虚拟内存)
- FAT16、FAT32
- NTFS
- EXT4(Extended file system 4, 第四代扩展文件系统 )
- JFS
四、A partition tool for managing disksfdsik
fdisk -l [磁盘设备] //非交互式查看磁盘分区
fdisk [磁盘设备] //交互式查看和管理磁盘分区- m 打印出菜单(帮助列表)
- p 打印出当前分区表
- n 新建一个分区
- d 删除一个分区
- t 改变分区的格式和系统ID
- w 保存
- q 退出
[[email protected] ~]# fdisk /dev/sda //交互式查看和管理磁盘分区 欢迎使用 fdisk (util-linux 2.23.2). 更改将停留在内存中,直到您决定将更改写入磁盘. 使用写入命令前请三思. 命令(输入 m 获取帮助):m //m指令打印出菜单 命令操作 a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) 命令(输入 m 获取帮助):p //p指令打印出当前分区表 磁盘 /dev/sda:64.4 GB, 64424509440 字节,125829120 个扇区 Units = 扇区 of 1 * 512 = 512 bytes 扇区大小(逻辑/物理):512 字节 / 512 字节 I/O 大小(最小/最佳):512 字节 / 512 字节 磁盘标签类型:dos 磁盘标识符:0x000c4763 设备 Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 31467519 14684160 8e Linux LVM 命令(输入 m 获取帮助):q //q指令退出五、创建文件系统(格式化)
创建文件系统mkfs命令
mkfs.文件系统类型 分区设备 //分区设备位置都要用绝对路径
[[email protected] ~]# mkfs.xfs /dev/sdb1 //将sdb1格式化为XFS文件系统
meta-data=/dev/sdb3 isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0六、挂载和卸载
挂载——mount命令
mount [-t 文件系统类型] 存储设备 挂载点目录
注意:
- 挂载目录需事先存在,不能挂载不存在的目录.
- 最好挂载空目录,不然挂载点下原有文件可能丢失或被隐藏.
- 挂载点目录不可被其他进程使用到.
- 一个目录不能同时挂载多个设备.
- 一个分区设备不能同时挂载到多个目录下.
解挂载——umount命令
umount 存储设备位置
边栏推荐
- markdown编辑器模板
- Dsf5.0 bounced points determine not return a value
- What impact does CIPU have on the cloud computing industry?
- [Day1] VMware software installation
- IP地址及子网的划分
- 入门文档06 向流(stream)中添加文件
- Getting Started 04 When a task depends on another task, it needs to be executed in sequence
- 正则表达式小实例--验证邮箱地址
- spark operator - map vs mapPartitions operator
- Getting Started 05 Using cb() to indicate that the current task is complete
猜你喜欢
随机推荐
The Servlet to jump to the JSP page, forwarding and redirection
错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
[Day5] Soft and hard links File storage, deletion, directory management commands
Call the TensorFlow Objection Detection API for object detection and save the detection results locally
Dsf5.0 bounced points determine not return a value
正则表达式小示例--获取重复最多的字符及其数量
I/O performance and reliability
CIPU, what impact does it have on the cloud computing industry?
硬盘分区和永久挂载
Getting Started Doc 06 Adding files to a stream
【Day8】Knowledge about disk and disk partition
图片压缩失效问题
dsf5.0新建页面访问时重定向到首页的问题
[Day6] File system permission management, file special permissions, hidden attributes
LeetCode Interview Questions
【Day6】文件系统权限管理 文件特殊权限 隐藏属性
[Day8] Commands involved in using LVM to expand
逻辑卷创建
Cloud computing - osi seven layers and TCP\IP protocol
入门文档05-2 使用return指示当前任务已完成









