Raid阵列与lvm逻辑卷组(下)

简介:

案例二:使用磁盘分区和磁盘阵列(Raid5)创建逻辑卷

要求:使用2块磁盘分区进行逻辑卷的创建,3块磁盘做Raid5后创建成逻辑卷

1.磁盘分区(/dev/sdc不做分区,使用整块磁盘。/dev/sdd,/dev/sde,/dev/sdf分区方法相同,这里不再赘述)

[root@lyt ~]# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

The number of cylinders for this disk is set to 2610.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

 

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

 

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n

 

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-2610, default 1): 

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +200M

Command (m for help): t

 

Selected partition 1

Hex code (type L to list codes): 8e

Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p 

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

 

   Device Boot      Start         End      Blocks   Id  System、

 

/dev/sdb1               1          25      200781   8e  Linux LVM

Command (m for help): w 

 

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@lyt ~]# 

2.创建Raid5(使用/dev/sdd1,/dev/sde1,/dev/sdf1)

[root@lyt ~]# mdadm -Cv /dev/md0 -l 5 -n 3 /dev/sdd1 /dev/sde1 /dev/sdf1   #C表示创建,v表示显示详细信息,md0是设备。-l表示创建raid的级别,-n表示成员数量

mdadm: layout defaults to left-symmetric

mdadm: chunk size defaults to 64K

mdadm: size set to 200704K

mdadm: array /dev/md0 started.

[root@lyt ~]# mdadm -Cv /dev/md1 -l 5 -n 3 /dev/sdd2 /dev/sde2 /dev/sdf2

 

mdadm: layout defaults to left-symmetric

mdadm: chunk size defaults to 64K

mdadm: size set to 200704K

mdadm: array /dev/md1 started.。

[root@lyt ~]# cat  /proc/mdstat     #查看状态

Personalities : [raid6] [raid5] [raid4] 

md1 : active raid5 sdf2[2] sde2[1] sdd2[0]

      401408 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

      

md0 : active raid5 sdf1[2] sde1[1] sdd1[0]

      401408 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

      

unused devices: <none>

 

[root@lyt ~]# mdadm --detail /dev/md0    #查看md0的详细信息

 

/dev/md0:

        Version : 0.90

  Creation Time : Mon Dec 24 21:09:25 2012

     Raid Level : raid5

     Array Size : 401408 (392.07 MiB 411.04 MB)

  Used Dev Size : 200704 (196.03 MiB 205.52 MB)

   Raid Devices : 3

  Total Devices : 3

Preferred Minor : 0

    Persistence : Superblock is persistent

 

    Update Time : Mon Dec 24 21:12:38 2012

 

          State : clean

 Active Devices : 3

Working Devices : 3

 Failed Devices : 0

  Spare Devices : 0


         Layout : left-symmetric

     Chunk Size : 64K

 

           UUID : b5680dee:d452c142:037e51af:5c72eea9

         Events : 0.2

 

    Number   Major   Minor   RaidDevice State

 

       0       8       49        0      active sync   /dev/sdd1

       1       8       65        1      active sync   /dev/sde1

       2       8       81        2      active sync   /dev/sdf1 

[root@lyt ~]# mdadm --detail /dev/md1    #查看md1的详细信息

 

/dev/md1:

        Version : 0.90

  Creation Time : Mon Dec 24 21:10:02 2012

     Raid Level : raid5

     Array Size : 401408 (392.07 MiB 411.04 MB)

  Used Dev Size : 200704 (196.03 MiB 205.52 MB)

   Raid Devices : 3

  Total Devices : 3

Preferred Minor : 1

    Persistence : Superblock is persistent

 

    Update Time : Mon Dec 24 21:12:40 2012

 

          State : clean

 Active Devices : 3

Working Devices : 3

 Failed Devices : 0

  Spare Devices : 0

 

         Layout : left-symmetric 

 

     Chunk Size : 64K

 

           UUID : 931454bb:a68d6779:fa0087fb:b8609ca6

         Events : 0.2

 

    Number   Major   Minor   RaidDevice State

 

       0       8       50        0      active sync   /dev/sdd2

       1       8       66        1      active sync   /dev/sde2

       2       8       82        2      active sync   /dev/sdf2

[root@lyt ~]# 

3.创建物理卷

[root@lyt ~]# pvcreate /dev/sdb1   #分区

  Physical volume "/dev/sdb1" successfully created

[root@lyt ~]# pvcreate /dev/sdc    #整块磁盘

  Physical volume "/dev/sdc" successfully created

[root@lyt ~]# pvcreate /dev/md0    #Raid5创建成物理卷

  Physical volume "/dev/md0" successfully created

[root@lyt ~]# pvcreate /dev/md1    #Raid5创建成物理卷

  Physical volume "/dev/md1" successfully created

4.创建卷组

[root@lyt ~]# vgcreate testvg /dev/sdb1 /dev/sdc /dev/md0 /dev/md1

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Volume group "testvg" successfully created

5.创建逻辑卷

[root@lyt ~]# lvcreate -L 1000M -n testlv testvg   #-L表示大小,-n表示名字

  Logical volume "testlv" created

6.格式化逻辑卷

[root@lyt ~]# mkfs -t ext3 /dev/testvg/testlv    #格式化

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

128000 inodes, 256000 blocks

12800 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=264241152

8 block groups

32768 blocks per group, 32768 fragments per group

16000 inodes per group

Superblock backups stored on blocks: 

32768, 98304, 163840, 229376

 

Writing inode tables: done                            

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 25 mounts or

 

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@lyt ~]# 

7.挂载

[root@lyt ~]# mkdir /testlv

[root@lyt ~]# mount /dev/testvg/testlv /testlv/

[root@lyt ~]# ll /testlv/

total 16

drwx------ 2 root root 16384 Dec 24 21:24 lost+found

[root@lyt testlv]# df -h 

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       18G  2.6G   15G  15% /

/dev/sda1              99M   12M   82M  13% /boot

tmpfs                 179M     0  179M   0% /dev/shm

/dev/mapper/testvg-testlv

                      985M   18M  918M   2% /testlv










本文转自 liuyatao666 51CTO博客,原文链接:http://blog.51cto.com/5503845/1125110,如需转载请自行联系原作者
目录
相关文章
|
存储 Java 调度
开发踩坑记录之二:谨慎使用Spring中的@Scheduled注解
在一些业务场景中需要执行定时操作来完成一些周期性的任务,比如每隔一周删除一周前的某些历史数据以及定时进行某项检测任务等等。在日常开发中比较简单的实现方式就是使用Spring的@Scheduled(具体使用方法不再赘述)注解。但是在修改服务器时间时会导致定时任务不执行情况的发生,解决的办法是当修改服务器时间后,将服务进行重启就可以避免此现象的发生。本文将主要探讨服务器时间修改导致@Scheduled注解失效的原因,同时找到在修改服务器时间后不重启服务的情况下,定时任务仍然正常执行的方法。 @Scheduled失效原因分析 解析流程图 使用新的方法
开发踩坑记录之二:谨慎使用Spring中的@Scheduled注解
|
Ubuntu Windows
教你彻底卸载Ubuntu双系统,去污不残留
教你彻底卸载Ubuntu双系统,去污不残留
4263 0
教你彻底卸载Ubuntu双系统,去污不残留
|
3月前
|
存储 JavaScript 安全
Web渗透-XSS漏洞深入及xss-labs靶场实战
XSS(跨站脚本攻击)是常见的Web安全漏洞,通过在网页中注入恶意脚本,窃取用户信息或执行非法操作。本文介绍其原理、分类(反射型、存储型、DOM型)、测试方法及xss-labs靶场实战案例,帮助理解与防御XSS攻击。
1021 1
Web渗透-XSS漏洞深入及xss-labs靶场实战
|
8月前
|
机器学习/深度学习 自然语言处理 人机交互
重磅发布|支持东方40语种+中国22方言的新SOTA语音大模型Dolphin开源啦!
在当今数字化时代,语音识别技术已成为人机交互的关键桥梁,广泛应用于智能客服、语音助手、会议转录等众多领域。
575 0
|
8月前
|
自然语言处理 API 数据库
2025年大模型就业:核心技术趋势、技能要求与职业发展全景解析
随着大语言模型(Large Language Models, LLMs)的技术飞速迭代,人工智能领域正经历从通用对话工具向高度智能化、任务导向的智能体(Agent)系统的深刻转型。到2025年4月,企业对掌握LLM相关技术的专业人才需求持续高涨,核心能力聚焦于检索增强生成(RAG)、智能体任务自动化、模型对齐优化以及多模态融合。本文将全面剖析2025年大模型就业市场的技术演进路径、核心技能要求、行业应用场景、推荐实践项目以及职业发展建议,旨在为从业者提供详尽的职业规划指南,帮助其精准把握行业机遇。
1935 6
|
机器学习/深度学习 JSON Linux
NSLog日志输出不全问题分析与解决方案
NSLog日志输出不全问题分析与解决方案
543 0
|
机器学习/深度学习 人工智能 自然语言处理
Transformer面试题总结101道
Transformer面试题总结101道
1894 0
|
存储 监控 安全
JVM工作原理与实战(五):类的生命周期-加载阶段
JVM作为Java程序的运行环境,其负责解释和执行字节码,管理内存,确保安全,支持多线程和提供性能监控工具,以及确保程序的跨平台运行。本文主要介绍了类的生命周期、类的加载阶段等内容。
199 5