博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
建立共享存储实验记录
阅读量:7093 次
发布时间:2019-06-28

本文共 11286 字,大约阅读时间需要 37 分钟。

hot3.png

共享存储配置
    (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 -lDisk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00056562   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          39      307200   83  LinuxPartition 1 does not end on cylinder boundary./dev/sda2              39        2358    18631680   83  Linux/dev/sda3            2358        2611     2031616   82  Linux swap / SolarisDisk /dev/sdb: 1073 MB, 1073741824 bytes255 heads, 63 sectors/track, 130 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000
    (3).初始化sdb
[root@node0 host2]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding 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): mCommand 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): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 1First cylinder (1-130, default 1): Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): Using default value 130Command (m for help): tSelected partition 1Hex code (type L to list codes): 8eChanged system type of partition 1 to 8e (Linux LVM)Command (m for help): wThe 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]# partprobeWarning: 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/lvdatamke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks128016 inodes, 512000 blocks25600 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6763315263 block groups8192 blocks per group, 8192 fragments per group2032 inodes per groupSuperblock backups stored on blocks: 	8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409Writing inode tables: done                            Creating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 23 mounts or180 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 -hFilesystem            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 nfsnfs-utils-1.2.3-64.el6.x86_64nfs-utils-lib-devel-1.1.5-11.el6.x86_64nfs4-acl-tools-0.3.3-7.el6.x86_64nfs-utils-lib-1.1.5-11.el6.x86_64[root@node0 ha]# rpm -qa | grep rpcbindrpcbind-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 statusrpcbind (pid  1802) is running...[root@node0 ha]# /etc/init.d/nfs statusrpc.svcgssd is stoppedrpc.mountd is stoppednfsd is stoppedrpc.rquotad is stopped[root@node0 ha]# /etc/init.d/nfs startStarting 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 -hFilesystem            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% /boot192.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/lvdataresize2fs 1.41.12 (17-May-2010)Filesystem at /dev/pgdata/lvdata is mounted on /home/ha/data; on-line resizing requiredold desc_blocks = 2, new_desc_blocks = 9Performing 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 -hFilesystem            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]#

转载于:https://my.oschina.net/Suregogo/blog/552175

你可能感兴趣的文章
关于在系统中插入视频聊天的功能问题
查看>>
Leetcode#114Flatten Binary Tree to Linked List
查看>>
七牛云冯立元:边缘存储的演进之路
查看>>
详解用户,组,权限管理
查看>>
理解ASM(四)条带化原理和rebalance
查看>>
不升级skype,继续使用msn的办法
查看>>
Linux 批量删除群发邮件
查看>>
linux 批量修改文件名
查看>>
SQLserver 2008同步复制创建后新增表/函数/存储过程(不重新初始化快照)
查看>>
我们一起清除过的浮动
查看>>
python 实现(简单的一个购物商城小程序)
查看>>
Barracuda文件格式备份注意事项
查看>>
MYSQL安装之Yum
查看>>
程序员能亲自架构全国各地上万人同时访问的高并发大数据量的软件程序应该是职业生涯的荣幸...
查看>>
jquery load ($.load) 事件用法与分析(转)
查看>>
Flume-1.6.0学习笔记汇总
查看>>
sudo命令
查看>>
java内存回收机制详解
查看>>
bzoj4025 二分图
查看>>
5、Stage,Image,ImageButton,Label的初步学习
查看>>