ClusterStorage-236-2-在节点上配置存储条brick

0.实验环境图

1.在节点servera上,进行磁盘分区,创建物理卷,创建卷组,创建逻辑卷(使用瘦池,后面可以使用快照,预分配虚拟空间),格式化逻辑卷,创建挂载目录,编辑挂载配置文件,进行挂载,查看文件系统。

[root@servera ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x3e6cf982.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (20973568-41943039, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): 
Using default value 41943039
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@servera ~]# pvcreate /dev/vdb2
  Physical volume "/dev/vdb2" successfully created
[root@servera ~]# vgcreate vg /dev/vdb2
  Volume group "vg" successfully created
[root@servera ~]# lvcreate -l 100%FREE -T vg/thinpool
  Logical volume "thinpool" created.
[root@servera ~]# lvcreate -V 2G -T vg/thinpool -n test
  Logical volume "test" created.

扫描二维码关注公众号,回复: 6081894 查看本文章

[root@servera ~]# lvcreate -V 2G -T vg/thinpool -n prod
  Logical volume "prod" created.
[root@servera ~]# mkfs.xfs -i size=512 /dev/vg/test
meta-data=/dev/vg/test           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@servera ~]# mkfs.xfs -i size=512 /dev/vg/prod
meta-data=/dev/vg/prod           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@servera ~]# mkdir -p /bricks/test
[root@servera ~]# mkdir -p /bricks/prod
[root@servera ~]# echo "/dev/vg/test /bricks/test xfs defaults 0 0" >> /etc/fstab
[root@servera ~]# echo "/dev/vg/prod /bricks/prod xfs defaults 0 0" >> /etc/fstab
[root@servera ~]# mount -a
[root@servera ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/vda1           xfs        10G  1.6G  8.5G  16% /
devtmpfs            devtmpfs  902M     0  902M   0% /dev
tmpfs               tmpfs     920M     0  920M   0% /dev/shm
tmpfs               tmpfs     920M   51M  870M   6% /run
tmpfs               tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs               tmpfs     184M     0  184M   0% /run/user/0
/dev/mapper/vg-test xfs       2.0G   33M  2.0G   2% /bricks/test
/dev/mapper/vg-prod xfs       2.0G   33M  2.0G   2% /bricks/prod
 

2.在节点serverb上,进行磁盘分区,创建物理卷,创建卷组,创建逻辑卷(使用瘦池,后面可以使用快照,预分配虚拟空间),格式化逻辑卷,创建挂载目录,编辑挂载配置文件,进行挂载,查看文件系统。

[root@serverb ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x2ebbac5f.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (20973568-41943039, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): 
Using default value 41943039
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@serverb ~]# pvcreate /dev/vdb2
  Physical volume "/dev/vdb2" successfully created
[root@serverb ~]# vgcreate vg /dev/vdb2
  Volume group "vg" successfully created
[root@serverb ~]# lvcreate -l 100%FREE -T vg/thinpool
  Logical volume "thinpool" created.
[root@serverb ~]# lvcreate -V 2G -T vg/thinpool -n test
  Logical volume "test" created.
[root@serverb ~]# lvcreate -V 2G -T vg/thinpool -n prod
  Logical volume "prod" created.
[root@serverb ~]# mkfs.xfs -i size=512 /dev/vg/test
meta-data=/dev/vg/test           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverb ~]# mkfs.xfs -i size=512 /dev/vg/prod
meta-data=/dev/vg/prod           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverb ~]# mkdir -p /bricks/test
[root@serverb ~]# mkdir -p /bricks/prod
[root@serverb ~]# echo "/dev/vg/test /bricks/test xfs defaults 0 0" >> /etc/fstab
[root@serverb ~]# echo "/dev/vg/prod /bricks/prod xfs defaults 0 0" >> /etc/fstab
[root@serverb ~]# mount -a
[root@serverb ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/vda1           xfs        10G  1.6G  8.5G  16% /
devtmpfs            devtmpfs  902M     0  902M   0% /dev
tmpfs               tmpfs     920M     0  920M   0% /dev/shm
tmpfs               tmpfs     920M   51M  870M   6% /run
tmpfs               tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs               tmpfs     184M     0  184M   0% /run/user/0
/dev/mapper/vg-test xfs       2.0G   33M  2.0G   2% /bricks/test
/dev/mapper/vg-prod xfs       2.0G   33M  2.0G   2% /bricks/prod
 

3.在节点serverc上,进行磁盘分区,创建物理卷,创建卷组,创建逻辑卷(使用瘦池,后面可以使用快照,预分配虚拟空间),格式化逻辑卷,创建挂载目录,编辑挂载配置文件,进行挂载,查看文件系统。

[root@serverc ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x25ec0516.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (20973568-41943039, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): 
Using default value 41943039
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@serverc ~]# pvcreate /dev/vdb2
  Physical volume "/dev/vdb2" successfully created
[root@serverc ~]# vgcreate vg /dev/vdb2
  Volume group "vg" successfully created
[root@serverc ~]# lvcreate -l 100%FREE -T vg/thinpool
  Logical volume "thinpool" created.
[root@serverc ~]# lvcreate -V 2G -T vg/thinpool -n sec
  Logical volume "sec" created.
[root@serverc ~]# lvcreate -V 2G -T vg/thinpool -n prod
  Logical volume "prod" created.
[root@serverc ~]# mkfs.xfs -i size=512 /dev/vg/sec
meta-data=/dev/vg/sec            isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverc ~]# mkfs.xfs -i size=512 /dev/vg/prod
meta-data=/dev/vg/prod           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverc ~]# mkdir -p /bricks/sec
[root@serverc ~]# mkdir -p /bricks/prod
[root@serverc ~]# echo "/dev/vg/sec /bricks/sec xfs defaults 0 0" >> /etc/fstab
[root@serverc ~]# echo "/dev/vg/prod /bricks/prod xfs defaults 0 0" >> /etc/fstab
[root@serverc ~]# mount -a
[root@serverc ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/vda1           xfs        10G  1.6G  8.5G  16% /
devtmpfs            devtmpfs  902M     0  902M   0% /dev
tmpfs               tmpfs     920M     0  920M   0% /dev/shm
tmpfs               tmpfs     920M   51M  870M   6% /run
tmpfs               tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs               tmpfs     184M     0  184M   0% /run/user/0
/dev/mapper/vg-sec  xfs       2.0G   33M  2.0G   2% /bricks/sec
/dev/mapper/vg-prod xfs       2.0G   33M  2.0G   2% /bricks/prod
 

4.在节点serverd上,进行磁盘分区,创建物理卷,创建卷组,创建逻辑卷(使用瘦池,后面可以使用快照,预分配虚拟空间),格式化逻辑卷,创建挂载目录,编辑挂载配置文件,进行挂载,查看文件系统。

[root@serverd ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x30f8f2b7.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (20973568-41943039, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): 
Using default value 41943039
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@serverd ~]# pvcreate /dev/vdb2
  Physical volume "/dev/vdb2" successfully created
[root@serverd ~]# vgcreate vg /dev/vdb2
  Volume group "vg" successfully created
[root@serverd ~]# lvcreate -l 100%FREE -T vg/thinpool
  Logical volume "thinpool" created.
[root@serverd ~]# lvcreate -V 2G -T vg/thinpool -n sec
  Logical volume "sec" created.
[root@serverd ~]# lvcreate -V 2G -T vg/thinpool -n prod
  Logical volume "prod" created.
[root@serverd ~]# mkfs.xfs -i size=512 /dev/vg/sec
meta-data=/dev/vg/sec            isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverd ~]# mkfs.xfs -i size=512 /dev/vg/prod
meta-data=/dev/vg/prod           isize=512    agcount=8, agsize=65520 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=524160, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@serverd ~]# mkdir -p /bricks/sec
[root@serverd ~]# mkdir -p /bricks/prod
[root@serverd ~]# echo "/dev/vg/sec /bricks/sec xfs defaults 0 0" >> /etc/fstab
[root@serverd ~]# echo "/dev/vg/prod /bricks/prod xfs defaults 0 0" >> /etc/fstab
[root@serverd ~]# mount -a
[root@serverd ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/vda1           xfs        10G  1.6G  8.5G  16% /
devtmpfs            devtmpfs  902M     0  902M   0% /dev
tmpfs               tmpfs     920M     0  920M   0% /dev/shm
tmpfs               tmpfs     920M   51M  870M   6% /run
tmpfs               tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs               tmpfs     184M     0  184M   0% /run/user/0
/dev/mapper/vg-sec  xfs       2.0G   33M  2.0G   2% /bricks/sec
/dev/mapper/vg-prod xfs       2.0G   33M  2.0G   2% /bricks/prod
 

猜你喜欢

转载自blog.csdn.net/ligan1115/article/details/88396685