第七周作业

2、总结RAID的各个级别及其组合方式和性能的不同。

RAID类型:
RAID 0、RAID 1、RAID 4、RAID 5、RAID 6、RAID 10、RAID 01、RAID 50

RAID常用性能介绍:
RAID 0:需要至少2块硬盘,读写性能提升,可用空间为n容量之和,无容错能力。
RAID 1:至少需要2块硬盘,硬盘数为2的倍数。可用空间为n/2容量的空间,读性能提升,写性能降低,有冗余能力。
RAID 5:至少需要3块硬盘,硬盘数为3块以上。可用空间为(n-1)读写性能提升,有容错能力。最多允许坏1块盘。
RAID 6:至少需要4块硬盘,硬盘数为4块以上。可以空间为(n-2)的空间容量,读写性能提升,有容错能力。最多允许坏2块盘。
RAID 10:至少4块盘,硬盘数为4的偶数。可用空间为n/2,读写性能提升,有容错能力,每组镜像最多只能坏一块。先组RAID 1再组RAID 0。
RAID 01:至少4块盘,硬盘数为4以上的偶数。可用空间为n/2,读写性能提升,有容错能力。不同镜像不能坏存储相同内容的硬盘。先组RAID 0再组RAID 1.


3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项

#创建2G分区
[root@centos8 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0   50G  0 part /data
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0    2G  0 part [SWAP]
sr0     11:0    1  7.7G  0 rom  
[root@centos8 ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
All primary partitions are in use.
Adding logical partition 6
First sector (320870400-419430399, default 320870400): 
Last sector, +sectors or +size{K,M,G,T,P} (320870400-419430399, default 419430399): +2G

Created a new partition 6 of type 'Linux' and of size 2 GiB.

Command (m for help): p
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 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
Disklabel type: dos
Disk identifier: 0xcc0623e1

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048   2099199   2097152    1G 83 Linux
/dev/sda2         2099200 211814399 209715200  100G 83 Linux
/dev/sda3       211814400 316671999 104857600   50G 83 Linux
/dev/sda4       316672000 419430399 102758400   49G  5 Extended
/dev/sda5       316674048 320868351   4194304    2G 82 Linux swap / Solaris
/dev/sda6       320870400 325064703   4194304    2G 83 Linux

Command (m for help): w
The partition table has been altered.
Syncing disks.

[root@centos8 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0   50G  0 part /data
├─sda4   8:4    0    1K  0 part 
├─sda5   8:5    0    2G  0 part [SWAP]
└─sda6   8:6    0    2G  0 part 
sr0     11:0    1  7.7G  0 rom 

#创建2G文件系统

[root@centos8 ~]# mkfs.ext4 -b 2048 -L 'TEST' -m 1 /dev/sda6
mke2fs 1.45.6 (20-Mar-2020)
/dev/sda6 contains a ext4 file system labelled 'TEST'
    created on Sun Jan 10 22:28:38 2021
Proceed anyway? (y,N) y
Creating filesystem with 1048576 2k blocks and 131072 inodes
Filesystem UUID: b200988b-fe8c-4f03-969a-a81bf64f7101
Superblock backups stored on blocks: 
    16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 
[root@centos8 ~]# lsblk -f
NAME   FSTYPE  LABEL                      UUID                                 MOUNTPOINT
sda                                                                            
├─sda1 ext4                               7ee7650b-9e95-4d2f-b4de-9f691e67f1dc /boot
├─sda2 xfs                                bfefda69-47bf-4448-8686-af65c2b22aca /
├─sda3 xfs                                41fa2dd3-2e4b-4083-9585-508125f8d1b1 /data
├─sda4                                                                         
├─sda5 swap                               82e4e1d3-b679-428f-bceb-f334b48788c4 [SWAP]
└─sda6 ext4    TEST                       b200988b-fe8c-4f03-969a-a81bf64f7101 
sr0    iso9660 CentOS-8-2-2004-x86_64-dvd 2020-06-08-22-08-25-00      

#修改挂载配置文件
[root@centos8 http24]# vim /etc/fstab 
# 
# /etc/fstab
# Created by anaconda on Tue Sep  1 20:25:59 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=bfefda69-47bf-4448-8686-af65c2b22aca /                       xfs     defaults        0 0
UUID=7ee7650b-9e95-4d2f-b4de-9f691e67f1dc /boot                   ext4    defaults        1 2
UUID=41fa2dd3-2e4b-4083-9585-508125f8d1b1 /data                   xfs     defaults        0 0
UUID=82e4e1d3-b679-428f-bceb-f334b48788c4 swap                    swap    defaults        0 0

UUID=b200988b-fe8c-4f03-969a-a81bf64f7101 /mnt                    ext4    defaults        0 0 

#挂载sda6
[root@centos8 ~]# mount /dev/sda6 /mnt
[root@centos8 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0   50G  0 part /data
├─sda4   8:4    0    1K  0 part 
├─sda5   8:5    0    2G  0 part [SWAP]
└─sda6   8:6    0    2G  0 part /mnt
sr0     11:0    1  7.7G  0 rom  
[root@centos8 http24]# dumpe2fs -h /dev/sda6
dumpe2fs 1.45.6 (20-Mar-2020)
Filesystem volume name:   TEST
Last mounted on:          <not available>
Filesystem UUID:          b200988b-fe8c-4f03-969a-a81bf64f7101
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              131072
Block count:              1048576
Reserved block count:     10485
Free blocks:              1011035
Free inodes:              131061
First block:              0
Block size:               2048
Fragment size:            2048
Group descriptor size:    64
Reserved GDT blocks:      512
Blocks per group:         16384
Fragments per group:      16384
Inodes per group:         2048
Inode blocks per group:   256
Flex block group size:    16
Filesystem created:       Sun Jan 10 22:46:51 2021
Last mount time:          n/a
Last write time:          Sun Jan 10 22:46:52 2021
Mount count:              0
Maximum mount count:      -1
Last checked:             Sun Jan 10 22:46:51 2021
Check interval:           0 (<none>)
Lifetime writes:          1058 kB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      b4284201-c662-49e3-9417-7a32fd2de10b
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xe25211a7
Journal features:         (none)
Journal size:             32M
Journal length:           16384
Journal sequence:         0x00000001
Journal start:            0

4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录

#创建两个分区,5G和15G
[root@centos8 ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
All primary partitions are in use.
Adding logical partition 6
First sector (320870400-419430399, default 320870400): 
Last sector, +sectors or +size{K,M,G,T,P} (320870400-419430399, default 419430399): +5G

Created a new partition 6 of type 'Linux' and of size 5 GiB.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 7
First sector (331358208-419430399, default 331358208): 
Last sector, +sectors or +size{K,M,G,T,P} (331358208-419430399, default 419430399): +15G

Created a new partition 7 of type 'Linux' and of size 15 GiB.

Command (m for help): t
Partition number (1-7, default 7): 6
Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): t
Partition number (1-7, default 7): 7
Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): p
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 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
Disklabel type: dos
Disk identifier: 0xcc0623e1

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048   2099199   2097152    1G 83 Linux
/dev/sda2         2099200 211814399 209715200  100G 83 Linux
/dev/sda3       211814400 316671999 104857600   50G 83 Linux
/dev/sda4       316672000 419430399 102758400   49G  5 Extended
/dev/sda5       316674048 320868351   4194304    2G 82 Linux swap / Solaris
/dev/sda6       320870400 331356159  10485760    5G 8e Linux LVM
/dev/sda7       331358208 362815487  31457280   15G 8e Linux LVM

Command (m for help): w
The partition table has been altered.
Syncing disks.


#创建物理卷
[root@centos8 ~]# pvcreate /dev/sda6 /dev/sda7
  Physical volume "/dev/sda6" successfully created.
  Physical volume "/dev/sda7" successfully created.
[root@centos8 ~]# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sda6     lvm2 ---   5.00g  5.00g
  /dev/sda7     lvm2 ---  15.00g 15.00g

#创建卷组
[root@centos8 ~]# vgcreate testvg -s 16 /dev/sda6 /dev/sda7 
  Volume group "testvg" successfully created
[root@centos8 ~]# vgdisplay 
  --- Volume group ---
  VG Name               testvg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <19.97 GiB
  PE Size               16.00 MiB
  Total PE              1278
  Alloc PE / Size       0 / 0   
  Free  PE / Size       1278 / <19.97 GiB
  VG UUID               NYKl9P-ExM5-Sd01-PaBK-uyjQ-erBH-h32Rff

#创建逻辑卷
[root@centos8 ~]# lvcreate -L +5G -n testlv testvg
  Logical volume "testlv" created.
[root@centos8 ~]# lvs
  LV     VG     Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  testlv testvg -wi-a----- 5.00g 

#创建文件系统并挂载至/users目录下
[root@centos8 ~]# mkfs.ext4 /dev/testvg/testlv 
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 1310720 4k blocks and 327680 inodes
Filesystem UUID: 23e40118-c7a0-4022-a064-c5f61773db34
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@centos8 ~]# lsblk -f
NAME              FSTYPE      LABEL                      UUID                                   MOUNTPOINT
sda                                                                                             
├─sda1            ext4                                   7ee7650b-9e95-4d2f-b4de-9f691e67f1dc   /boot
├─sda2            xfs                                    bfefda69-47bf-4448-8686-af65c2b22aca   /
├─sda3            xfs                                    41fa2dd3-2e4b-4083-9585-508125f8d1b1   /data
├─sda4                                                                                          
├─sda5            swap                                   82e4e1d3-b679-428f-bceb-f334b48788c4   [SWAP]
├─sda6            LVM2_member                            n9XqlZ-jXQl-N68R-tXeH-PvMa-2krK-hrddoT 
└─sda7            LVM2_member                            1rhzmz-zedq-CuL4-cq8w-EIhl-eyQN-0FxbaF 
  └─testvg-testlv ext4                                   23e40118-c7a0-4022-a064-c5f61773db34   
sr0               iso9660     CentOS-8-2-2004-x86_64-dvd 2020-06-08-22-08-25-00
[root@centos8 ~]# mkdir /users
[root@centos8 ~]# mount /dev/mapper/testvg-testlv /users
[root@centos8 ~]# lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                 8:0    0  200G  0 disk 
├─sda1              8:1    0    1G  0 part /boot
├─sda2              8:2    0  100G  0 part /
├─sda3              8:3    0   50G  0 part /data
├─sda4              8:4    0    1K  0 part 
├─sda5              8:5    0    2G  0 part [SWAP]
├─sda6              8:6    0    5G  0 part 
└─sda7              8:7    0   15G  0 part 
  └─testvg-testlv 253:0    0    5G  0 lvm  /users
sr0                11:0    1  7.7G  0 rom
#永久保存挂载
[root@centos8 users]# vim /etc/fstab
# Created by anaconda on Tue Sep  1 20:25:59 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=bfefda69-47bf-4448-8686-af65c2b22aca /                       xfs     defaults        0 0
UUID=7ee7650b-9e95-4d2f-b4de-9f691e67f1dc /boot                   ext4    defaults        1 2
UUID=41fa2dd3-2e4b-4083-9585-508125f8d1b1 /data                   xfs     defaults        0 0
UUID=82e4e1d3-b679-428f-bceb-f334b48788c4 swap                    swap    defaults        0 0
UUID=23e40118-c7a0-4022-a064-c5f61773db34 /users                  ext4    defaults        0 0

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,530评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 86,403评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,120评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,770评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,758评论 5 367
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,649评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,021评论 3 398
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,675评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,931评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,659评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,751评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,410评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,004评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,969评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,042评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,493评论 2 343

推荐阅读更多精彩内容

  • 1、自建yum仓库,分别为网络源和本地源 一。配置网络源 首先用rpm安装autofs包 (用于神秘文件夹 /...
    N45080阅读 352评论 0 0
  • 1. 自建yum仓库,分别为网络源和本地源 1.1 自建网络源yum仓库1.1.1 仓库端配置 关闭防火墙和sel...
    letsgoheat_c1dc阅读 257评论 0 0
  • 1、自建yum仓库,分别为网络源和本地源 配置网络源 配置本地源 2、编译安装http2.4,实现可以正常访问,并...
    N45刘莅轩阅读 247评论 0 0
  • 1.创建一个10G分区,并格式为ext4文件系统 (1)要求其block大小为2048,预留空间百分比为2,卷标为...
    小翔脸阅读 629评论 0 0
  • 1、自建yum仓库,分别为网络源和本地源2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。3、...
    阿浩浩浩阅读 445评论 0 1