day22
作者:黄胜
归档:课堂笔记
日期:2019/3/29
一、parted方式分区
[root@oldboyedu ~]# parted /dev/sdb --》进入parted分区工具模式
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
n number and copyright information of GNU Parted
(parted) mklabel gpt --》创建分区表类型
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No? Yes
(parted) p --》打印查看分区信息
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart primary 481 580 --》创建100M的主分区分区
Warning: You requested a partition from 481MB to 580MB (sectors 939453..1132812).
The closest location we can manage is 481MB to 481MB (sectors 940031..940031).
Is this still acceptable to you?
Yes/No? yes
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 480MB 480MB primary
3 481MB 481MB 512B primary
2 481MB 580MB 98.6MB primary
(parted) mkpart logic 581 600 ——》创建逻辑分区并查看
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 480MB 480MB primary
3 481MB 481MB 512B primary
2 481MB 580MB 98.6MB primary
4 581MB 600MB 18.9MB logic
(parted) rm 4 #删除 ——》删除逻辑分区并查看
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 480MB 480MB primary
3 481MB 481MB 512B primary
2 481MB 580MB 98.6MB primary
最后直接确认按q保存退出分区安装
二、dd 命令和创建虚拟的文件系统
什么是文件系统?
计算机存储和组织数据的方法或者机制,落地是一个软件。
为什么需要文件系统?
磁盘、物理介质、磁粒子物理元素。硬件需要软件驱动使用,磁盘则需要文件系统驱动。
文件系统实现通过磁盘管理规划、存储数据 。
文件系统有哪些种类?
windows :NFTS、fat32、msdos
linux:ext2、ext3(c5)、ext4(c6)、Xfs(c7)
创建文件系统实践:
dd if=/dev/sda of=/dev/sdc bs=512 count=10240
来源 生成文件系统 block大小 块个数
命令:dumpe2fs /dev/sdb查看ext文件系统内部细节
fsck 磁盘检查命令(一般不对正常磁盘使用)