磁盘管理之raid文件系统分区

磁盘管理之raid⽂件系统分区第1章 RAID 磁盘阵列
颜面骨折>少先队章程1.1 使⽤raid的⽬的
1)获得更⼤的容量
2)让数据更安全
3)读写速度更快
1.2 raid0、raid1、raid5、raid10对⽐
raid类型数量优点缺点使⽤类型
raid0 条带⾄少1块硬盘。把所有硬盘的容量加在⼀
起,读写速度更快⼀块硬盘损坏,整
体都不能使⽤
数据不是很重要,
追求性能
数据库的从库
集的某个节点
raid1 镜像只能是两块硬盘安全,有100%的冗余写⼊速度⽐较慢
读取还可以
成本较⾼
对数据安全要求⽐
较⾼,不需要太多
的性能
raid5⾄少三块硬盘有奇偶校验,有⼀定的冗
余,最多损坏1块硬盘损
失⼀块硬盘的容量
读取性能可以
写⼊很慢
⽐较通⽤。
+spare
可以作为热备
raid10
最少4块硬盘
数量必须是偶数
读写的速度都很快,安全
性较⾼冗余,最多可以损
坏⼀半
驻波成本⾼
容量浪费⼀半
数据库
重要的⽂件
第2章磁盘分区
2.1 mbr是什么
mbr引导:主引导记录
2.1.1 mbr在哪⾥
磁盘的0磁头 0磁道 1扇区前446字节
自由呼吸⼀个扇区的⼤⼩为512字节
前446字节    mbr
中间64字节分区表
最后2字节分区结束表⽰55AA
2.1.2 分区表
在分区表的64字节⾥,划分为4个格⼦ 16*4
每个格⼦⾥存放的是分区的信息(主分区扩展分区)
2.1.3 如何查看磁盘第⼀个扇区⾥的内容
拿出出来前512个字节
[root@znix ~]# dd if=/dev/sda of=/tmp/512.bin bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000190527 s, 2.7 MB/s
看下⽂件的类型
[root@znix ~]# file /tmp/512.bin
/tmp/512.bin: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x6280, GRUB version 0.94; partition 1: ID=0x83, active, starthead 32, startsector 2048, 409600 sectors; partition 2: ID=0x82, starthead 159, startsector 411648, 1572864 sectors; partition 3: ID=0x83, starthead 135, startsector 1984512, 18987008 sectors, code offset 0x48
2.1.4 如何查看⼆进制⽂件的内容
od命令查看⼆进制⽂件的内容
[root@znix ~]#  od -xa /tmp/512.bin
……
0000760    0000    0000    0000    0000    0000    0000    0000    aa55  结束标识符
nul nul nul nul nul nul nul nul nul nul nul nul nul nul  U  *
0001000
2.2 主分区、扩展分区、逻辑分区的关系
2.2.1 主分区
最多有4个主分区
2.2.2 扩展分区
没有办法直接使⽤,需要划分成逻辑分区才可以使⽤。
2.2.3 逻辑分区
必须要在扩展分区下⾯划分逻辑分区才可以使⽤。
逻辑分区
sas/sata/scsi/ 中为 sda  5-15
2.3 在系统中磁盘分区的命名
磁盘设备都放在/dev/⽬录下
sas/sata/scsi/接⼝    sd 开头
ide 接⼝              hd开头
2.3.1 磁盘名称⽰例
第⼀块硬盘 sda
第⼆块硬盘 sdb
第三块硬盘 sdc
2.3.2 第⼀块硬盘 sda
主分区 1-4
扩展分区 1-4 ⼀般为4
逻辑分区从5+开始
2.3.3 分区的命名规则
第⼀块硬盘的第⼀个主分区:sda1
第⼀块硬盘的第⼀个逻辑分区:sda5
第⼆块硬盘的第⼆个逻辑分区:sdb6
2.4 回顾分区⽅式
2.4.1 没有重要数据
/boot  200M    存放系统的引导信息内核
swap  交换分区防⽌内存⽤光了临时的⼀个内存
如果你的内存⼩于8G swap是内存的1.5倍如果你的内存⼤于8G swap给8G
/        根分区剩余多少给多少
2.4.2 很多重要数据
/boot  200M    存放系统的引导信息内核
swap  交换分区防⽌内存⽤光了临时的⼀个内存
如果你的内存⼩于8G swap是内存的1.5倍如果你的内存⼤于8G swap给8G
/        根分区              20G-200G
/data  存放重要的数据剩余多少给多少
2.4.3 不知道数据是否重要
/boot  200M    存放系统的引导信息内核
swap  交换分区防⽌内存⽤光了临时的⼀个内存
如果你的内存⼩于8G swap是内存的1.5倍如果你的内存⼤于8G swap给8G
/        根分区              20G-200G
剩余空间不分放着谁使⽤这台服务器谁来分区
经济效益和社会效益2.5 ps 命令内容详解--每列的含义
2.5.1 ps aux 中的vsz与rss
[root@znix shm]# ps aux
农行核心价值观USER        PID %CPU %MEM    VSZ  RSS TTY      STAT START  TIME COMMAND root          1  0.0  0.2  19352  1300 ?        Ss  Sep14  0:01 /sbin/ini
⽤户进程号  CPU  内存
⚠VSZ 进程所占⽤的虚拟内存的⼤⼩(物理内存+swap)
⚠RSS 进程所占⽤的内存(物理内存)
2.5.2 ps -ef 列含义系简介
[root@znix shm]# ps -ef
UID        PID  PPID    C STIME TTY        TIME  CMD
root          1      0    0 Sep14 ?      00:00:01  /sbin/init
⽤户名进程号⼦进程号运⾏了什么命令
第3章磁盘分区
3.1 linux⾥⾯的分区⼯具
fdisk  主要是给磁盘⼩于2T(只能出来分区表是mbr的)
parted  主要是给磁盘⼤于2T(gpt)
3.2 通过fdisk给磁盘进⾏分区(创建⼀个10M主分区和⼀个40M逻辑分区)3.2.1 使⽤fdisk会提⽰⼀个错误
[root@znix ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x31dcd35a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
警告:可以关闭dos的兼容模式,使⽤扇区作为分区的默认单位  -cu ↓
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):
3.2.2 fdisk添加上了 -cu 参数
-cu 参数是在分区的时候,能够以扇区的⽅式进⾏。
[root@znix ~]# fdisk -cu /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb9f506a4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):
3.2.3 查看fdisk的帮助信息
Command (m for help): m
Command action
d  delet
e a partition            删除⼀个分区
m  print this menu              显⽰帮助菜单
n  add a new partition          创建⼀个分区
p  print the partition table    显⽰分区表
q  quit without saving changes  退出不保存
w  write table to disk and exit  保存并退出
3.2.4 创建⼀个主分区
Command (m for help): n
Command action
e  extended      扩展分区
p  primary partition (1-4)  主分区
p
Partition number (1-4): 1  第⼀个分区
First sector (2048-208895, default 2048): 直接回车为默认
Using default value 2048  默认选择第⼀个扇区
Last sector, +sectors or +size{K,M,G} (2048-208895, default 208895): +10M 3.2.5 显⽰⼀下分出来的分区
Command (m for help): p
Disk /dev/sdb: 106 MB, 106954752 bytes
64 heads, 32 sectors/track, 102 cylinders, total 208896 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb9f506a4
Device Boot      Start        End      Blocks  Id  System
/dev/sdb1            2048      22527      10240  83
3.2.6 创建⼀个扩展分区
扩展分区的分区原则是:剩多少给多少
Command (m for help): n
Command action
e  extended  扩展分区
p  primary partition (1-4)
e
Partition number (1-4): 2
First sector (22528-208895, default 22528):
Using default value 22528
Last sector, +sectors or +size{K,M,G} (22528-208895, default 208895): Using default value 208895
3.2.7 显⽰现在的分区表信息
Command (m for help): p
Disk /dev/sdb: 106 MB, 106954752 bytes

本文发布于:2024-09-21 14:27:59,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/399021.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:分区   扇区   硬盘   信息   扩展   逻辑   磁盘
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议