当前位置:网站首页>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 存储设备位置
边栏推荐
- 深度 Zabbix 使用指南——来自惨绿少年
- 逻辑卷创建
- 【Day5】软硬链接 文件存储,删除,目录管理命令
- markdown editor template
- Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
- Getting Started Document 09 Standalone watch
- 图片压缩失效问题
- 实力卷王LinkSLA,实现运维工程师快乐摸鱼
- 入门文档05 使用cb()指示当前任务已完成
- 入门文档08 条件插件
猜你喜欢
随机推荐
入门文档06 向流(stream)中添加文件
【Day1】(超详细步骤)构建软RAID磁盘阵列
【Day5】软硬链接 文件存储,删除,目录管理命令
User and user group management, file permission management
RAID disk array
VRRP概述及实验
LeetCode Interview Questions
Logical volume creation
spark算子-map vs mapPartitions算子
spark source code-RPC communication mechanism
Wechat applet page jump to pass parameters
js dynamically get screen width and height
Dsf5.0 bounced points determine not return a value
硬盘分区和永久挂载
磁盘管理与文件系统
wc、grep、tar、vi/vim
spark operator-wholeTextFiles operator
VLAN details and experiments
spark operator-parallelize operator
The spark operator - repartition operator







![[Day1] VMware software installation](/img/24/20cc77e904dbe7dc1b5224c64d6329.png)

