文档章节

建立共享存储实验记录

PGSmith
 PGSmith
发布于 2015/12/28 11:00
字数 1619
阅读 74
收藏 5
点赞 0
评论 0
共享存储配置
    (1).添加一块1G硬盘
    (2).为了能不重启虚机的情况下,特作以下操作
[root@node0 host2]# grep mpt /sys/class/scsi_host/host?/proc_name
/sys/class/scsi_host/host2/proc_name:mptspi
[root@node0 host2]# vi /etc/exports 
[root@node0 host2]# echo "- - -" > /sys/class/scsi_host/host2/scan 
[root@node0 host2]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00056562

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              39        2358    18631680   83  Linux
/dev/sda3            2358        2611     2031616   82  Linux swap / Solaris

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
    (3).初始化sdb
[root@node0 host2]# 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 0x55dbe72b.
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)

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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   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)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): 
Using default value 130

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): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

    (4).建立lvm

[root@node0 host2]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@node0 host2]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
[root@node0 host2]# pvdisplay
  "/dev/sdb1" is a new physical volume of "1019.72 MiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               1019.72 MiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               dWj8Zh-V5X8-m9wc-tnnp-txIC-VqQq-jX2aRG
   
[root@node0 host2]# vgscan
  Reading all physical volumes.  This may take a while...
  No volume groups found
[root@node0 host2]# vgcreate pgdata /dev/sdb1
  Volume group "pgdata" successfully created
[root@node0 host2]# vgdisplay
  --- Volume group ---
  VG Name               pgdata
  System ID             
  Format                lvm2
  Metadata Areas        1
  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                1
  Act PV                1
  VG Size               1016.00 MiB
  PE Size               4.00 MiB
  Total PE              254
  Alloc PE / Size       0 / 0   
  Free  PE / Size       254 / 1016.00 MiB
  VG UUID               gYuSRU-nm7P-mnLq-2cC0-CbSG-mAXS-9CzfDS
   
[root@node0 host2]# lvcreate -L 500M -n lvdata pgdata
  Logical volume "lvdata" created
[root@node0 host2]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/pgdata/lvdata
  LV Name                lvdata
  VG Name                pgdata
  LV UUID                tcseQe-JSS8-P280-M46S-pBTN-tGuU-Wkl4Z5
  LV Write Access        read/write
  LV Creation host, time node0, 2015-12-27 06:56:46 -0800
  LV Status              available
  # open                 0
  LV Size                500.00 MiB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
[root@node0 host2]# mkfs -t ext4 /dev/pgdata/lvdata
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks: 
	8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override. 

    (5).建立本地映射
[root@node0 ha]# pwd
/home/ha
[root@node0 ha]# mkdir data
[root@node0 ha]# mount /dev/pgdata/lvdata data/
[root@node0 ha]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G  3.7G   13G  22% /
tmpfs                 491M  224K  491M   1% /dev/shm
/dev/sda1             291M   33M  243M  12% /boot
/dev/mapper/pgdata-lvdata
                      485M   11M  449M   3% /home/ha/data

    (6).建立远程映射

[root@node0 ha]# rpm -qa | grep nfs
nfs-utils-1.2.3-64.el6.x86_64
nfs-utils-lib-devel-1.1.5-11.el6.x86_64
nfs4-acl-tools-0.3.3-7.el6.x86_64
nfs-utils-lib-1.1.5-11.el6.x86_64
[root@node0 ha]# rpm -qa | grep rpcbind
rpcbind-0.2.0-11.el6.x86_64
[root@node0 ha]# cat /etc/exports 
/home/ha/data/ 192.168.238.0/24(rw,no_root_squash,no_all_squash,sync)
[root@node0 ha]# /etc/init.d/rpcbind status
rpcbind (pid  1802) is running...
[root@node0 ha]# /etc/init.d/nfs status
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
[root@node0 ha]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@node0 ha]#
[root@localhost ~]# cd /home/ha/
[root@localhost ha]# mkdir data
[root@localhost ha]# mount -t nfs 192.168.238.129:/home/ha/data/ data/
[root@localhost ha]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G  3.5G   14G  21% /
tmpfs                 491M  232K  491M   1% /dev/shm
/dev/sda1             291M   33M  243M  12% /boot
192.168.238.129:/home/ha/data/
                      485M   11M  449M   3% /home/ha/data
[root@localhost ha]#

    (7).添加一个2G硬盘后初始化,同(3)。
    (8).扩容

[root@node0 ha]# pvcreate /dev/sdc1 
  Physical volume "/dev/sdc1" successfully created
[root@node0 ha]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               pgdata
  PV Size               1019.72 MiB / not usable 3.72 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              254
  Free PE               129
  Allocated PE          125
  PV UUID               dWj8Zh-V5X8-m9wc-tnnp-txIC-VqQq-jX2aRG
   
  "/dev/sdc1" is a new physical volume of "2.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name               
  PV Size               2.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               WCO5zU-ExbX-1thO-E1to-N9tJ-Hpmu-kytdTQ
   
[root@node0 ha]# vgdisplay
  --- Volume group ---
  VG Name               pgdata
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1016.00 MiB
  PE Size               4.00 MiB
  Total PE              254
  Alloc PE / Size       125 / 500.00 MiB
  Free  PE / Size       129 / 516.00 MiB
  VG UUID               gYuSRU-nm7P-mnLq-2cC0-CbSG-mAXS-9CzfDS
   
[root@node0 ha]# vgextend pgdata /dev/sdc1 
  Volume group "pgdata" successfully extended
[root@node0 ha]# vgdisplay
  --- Volume group ---
  VG Name               pgdata
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              765
  Alloc PE / Size       125 / 500.00 MiB
  Free  PE / Size       640 / 2.50 GiB
  VG UUID               gYuSRU-nm7P-mnLq-2cC0-CbSG-mAXS-9CzfDS
   
[root@node0 ha]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/pgdata/lvdata
  LV Name                lvdata
  VG Name                pgdata
  LV UUID                tcseQe-JSS8-P280-M46S-pBTN-tGuU-Wkl4Z5
  LV Write Access        read/write
  LV Creation host, time node0, 2015-12-27 06:56:46 -0800
  LV Status              available
  # open                 1
  LV Size                500.00 MiB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
[root@node0 ha]# lvextend -L 2.2G /dev/pgdata/lvdata
  Rounding size to boundary between physical extents: 2.20 GiB
  Extending logical volume lvdata to 2.20 GiB
  Logical volume lvdata successfully resized
[root@node0 ha]# resize2fs /dev/pgdata/lvdata
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/pgdata/lvdata is mounted on /home/ha/data; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 9
Performing an on-line resize of /dev/pgdata/lvdata to 2310144 (1k) blocks.

The filesystem on /dev/pgdata/lvdata is now 2310144 blocks long.

[root@node0 ha]# 

    (9).验证

[root@node0 ha]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G  3.7G   13G  22% /
tmpfs                 491M  224K  491M   1% /dev/shm
/dev/sda1             291M   33M  243M  12% /boot
/dev/mapper/pgdata-lvdata
                      2.2G   11M  2.1G   1% /home/ha/data
[root@node0 ha]#

© 著作权归作者所有

共有 人打赏支持
PGSmith

PGSmith

粉丝 91
博文 53
码字总数 59331
作品 0
济南
后端工程师
Lync2010快速部署(一)---环境部署+拓扑安装发布

实验环境:Windows 2008R2 SP1,AD+DNS+DC集中在一台服务器上,Lync2010一台服务器(SQL用集成的),客户端测试一台或两台 一、AD+DNS+DC的安装过程省略,将Lync2010服务器加域 二、在DNS里添...

whyhb1916 ⋅ 2012/12/15 ⋅ 0

exchange系列(二)exchange2010邮箱服务器的配置

博主QQ:819594300 博客地址:http://zpf666.blog.51cto.com/ 有什么疑问的朋友可以联系博主,博主会帮你们解答,谢谢支持! 前言:exchange的每个邮箱都需要存储在数据库中,默认只有一个数...

技术小大人 ⋅ 2017/11/15 ⋅ 0

如何学好oracle课程

oracle的体系太庞大了,对于初学者来说,难免会有些无从下手的感觉,什么都想学,结果什么都学不好,所以把学习经验共享一下,希望让刚刚入门的人对oracle有一个总体的认识,少走一些弯路。 ...

slence ⋅ 2011/09/03 ⋅ 0

.Net分布式架构(二):基于Redis的Session共享

原文:.Net分布式架构(二):基于Redis的Session共享 一:Session简介   Session是什么呢?简单来说就是服务器给客户端的一个编号。当一台web服务器运行时,可能有若干个用户浏览正在运正在这...

杰克.陈 ⋅ 2017/12/07 ⋅ 0

10.11杭州Clouder lab 十分钟搭建共享应用1:函数计算及表格存储操作说明

欢迎大家来到无服务器(Serverless)编程的阿里云clouder lab实验课参与学习。 这几年,共享经济越来越火,大到共享汽车、共享电动车,小到共享雨伞,共享充电宝。人人参与,人人收益是共享经...

rocaltair ⋅ 2017/10/10 ⋅ 0

ClearCase四大功能详述(Build管理)

使用ClearCase,构造软件的处理过程可以和传统的方法兼容。对于ClearCase控制的数据可以使用自制脚本或本机的make程序,但ClearCase的向上兼容建立工具clearmake和omake为构造提供了重要的特...

晨曦之光 ⋅ 2012/03/09 ⋅ 0

Lync Server 2010部署安装

Microsoft Lync Server 2010 通信软件及其客户端软件(例如 Microsoft Lync 2010)使您的用户无论身在何处都可以使用新的方式进行连接并保持连接状态。Lync 2010 和 Lync Server 2010 将用户...

shihaibo ⋅ 2012/07/24 ⋅ 0

域用户配置文件的漫游配置(全)

漫游的优势: 1,方便用户的操作,域用户无论在哪个客户端登录,桌面环境配置都是一样的,可以在外地办公。 2,数据的统一存储,管理更方便。 一:搭建域控制器 1.此实验环境是windows2008 2...

赵一i ⋅ 2017/06/13 ⋅ 0

如何在ONTAP系统中显示历史版本

勒索病毒爆发导致使用CIFS协议的Windows用户深受其害,那么我们如何来保护自己的数据免收攻击呢?我想有几个方法可以规避类似问题发生 安装防病毒保护软件,从客户端根源防护,如果是VDI应用...

popeyeywy ⋅ 2017/07/06 ⋅ 0

平台架构中性动态分析--PANDA

PANDA 是一个开源的平台架构中性动态分析。它是建立在QEMU全系统模拟器,所以分析获得所有代码执行客人和所有数据。PANDA 提供添加记录和回放执行的能力,提供整个系统深入迭代分析。此外,回放...

红薯 ⋅ 2015/01/05 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

Spring | IOC AOP 注解 简单使用

写在前面的话 很久没更新笔记了,有人会抱怨:小冯啊,你是不是在偷懒啊,没有学习了。老哥,真的冤枉:我觉得我自己很菜,还在努力学习呢,正在学习Vue.js做管理系统呢。即便这样,我还是不...

Wenyi_Feng ⋅ 今天 ⋅ 0

博客迁移到 https://www.jianshu.com/u/aa501451a235

博客迁移到 https://www.jianshu.com/u/aa501451a235 本博客不再更新

为为02 ⋅ 今天 ⋅ 0

win10怎么彻底关闭自动更新

win10自带的更新每天都很多,每一次下载都要占用大量网络,而且安装要等得时间也蛮久的。 工具/原料 Win10 方法/步骤 单击左下角开始菜单点击设置图标进入设置界面 在设置窗口中输入“服务”...

阿K1225 ⋅ 今天 ⋅ 0

Elasticsearch 6.3.0 SQL功能使用案例分享

The best elasticsearch highlevel java rest api-----bboss Elasticsearch 6.3.0 官方新推出的SQL检索插件非常不错,本文一个实际案例来介绍其使用方法。 1.代码中的sql检索 @Testpu...

bboss ⋅ 今天 ⋅ 0

informix数据库在linux中的安装以及用java/c/c++访问

一、安装前准备 安装JDK(略) 到IBM官网上下载informix软件:iif.12.10.FC9DE.linux-x86_64.tar放在某个大家都可以访问的目录比如:/mypkg,并解压到该目录下。 我也放到了百度云和天翼云上...

wangxuwei ⋅ 今天 ⋅ 0

PHP语言系统ZBLOG或许无法重现月光博客的闪耀历史[图]

最近在写博客,希望通过自己努力打造一个优秀的教育类主题博客,名动江湖,但是问题来了,现在写博客还有前途吗?面对强大的自媒体站点围剿,还有信心和可能型吗? 至于程序部分,我选择了P...

原创小博客 ⋅ 今天 ⋅ 0

IntelliJ IDEA 2018.1新特性

工欲善其事必先利其器,如果有一款IDE可以让你更高效地专注于开发以及源码阅读,为什么不试一试? 本文转载自:netty技术内幕 3月27日,jetbrains正式发布期待已久的IntelliJ IDEA 2018.1,再...

Romane ⋅ 今天 ⋅ 0

浅谈设计模式之工厂模式

工厂模式(Factory Pattern)是 Java 中最常用的设计模式之一。这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。 在工厂模式中,我们在创建对象时不会对客户端暴露创建逻...

佛系程序猿灬 ⋅ 今天 ⋅ 0

Dockerfile基础命令总结

FROM 指定使用的基础base image FROM scratch # 制作base image ,不使用任何基础imageFROM centos # 使用base imageFROM ubuntu:14.04 尽量使用官方的base image,为了安全 LABEL 描述作...

ExtreU ⋅ 昨天 ⋅ 0

存储,对比私有云和公有云的不同

导读 说起公共存储,很难不与后网络公司时代的选择性外包联系起来,但尽管如此,它还是具备着简单和固有的可用性。公共存储的名字听起来也缺乏专有性,很像是把东西直接堆放在那里而不会得到...

问题终结者 ⋅ 昨天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部