文档章节

建立共享存储实验记录

PGSmith
 PGSmith
发布于 2015/12/28 11:00
字数 1619
阅读 75
收藏 5
共享存储配置
    (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

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

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

whyhb1916
2012/12/15
0
0
exchange系列(二)exchange2010邮箱服务器的配置

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

技术小大人
2017/11/15
0
0
.Net分布式架构(二):基于Redis的Session共享

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

杰克.陈
2017/12/07
0
0
10.11杭州Clouder lab 十分钟搭建共享应用1:函数计算及表格存储操作说明

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

rocaltair
2017/10/10
0
0
Lync Server 2010部署安装

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

shihaibo
2012/07/24
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

7月13日任务 for、while、break跳出、ontinue结束、exit退出

20.10 for循环 语法:for 变量名 in 条件; do …; done 案例1:计算1到100的和 #!/bin/bashsum=0for i in `seq 1 100`do    sum=$[$sum+$i]    echo $idoneecho $sum 案例2...

吕湘颖
37分钟前
0
0
qemu增量镜像的好处

可以快速恢复,相当于快照的功能。

simpower
45分钟前
0
0
Python3_Appium_QQ 实战

Python3_Appium实战 -海盐 APPium移动自动化测试 样例中 测试的 app 使用的是 QQ; Appium介绍 Appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生应用,web 应用和混合...

海盐宝宝
45分钟前
0
0
内网穿透利器-ngrok的图文安装

使用场景: 在做微信开发或是调银行或支付宝等支付系统的时候,本地想联调但是对方需要可以访问的域名或是外网IP才可以。但是,在本地如果不在路由器上做映射或是公司没有固定的外网IP。这种...

中凯_凯哥java
50分钟前
2
1
归约与分组 - 读《Java 8实战》

区分Collection,Collector和collect 代码中用到的类与方法用红框标出,可从git库中查看 收集器用作高级归约 // 按货币对交易进行分组Map<Currency, List<Transaction>> currencyListMap = g...

yysue
50分钟前
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部