DRBD 通过 LVM MKFS 并访问设备

DRBD 通过 LVM MKFS 并访问设备

我承认我目前处于实验阶段,但当我阅读文档时,这应该不是问题。我正在通过 LVM 配置 DRBD。

据我了解drbd00.res,我应该以 的身份访问该设备/dev/drbd00。但是,该设备不存在。相反,/dev/drbd0存在。但是,当我 时mkfs -t xfs on /dev/drbd0,下次启动时状态将变为无盘。我的步骤如下:

pvcreate /dev/sdc1
vgcreate shared1 /dev/sdc1
lvcreate --name shared1 -l 100%FREE shared1
drbdadm create-md drbd00
systemctl start drbd
drbdadm primary drbd00 --force

(等待同步)

[root@linclust1 ~]# mkfs -t xfs /dev/shared1/shared1
mkfs.xfs: cannot open /dev/shared1/shared1: Device or resource busy

[root@linclust1 ~]# mkfs -t xfs /dev/drbd0
meta-data=/dev/drbd0             isize=256    agcount=4, agsize=1310422 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=5241687, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

(等待同步)

[root@linclust1 ~]# cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 1AEFF755B8BD61B81A0AF27
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
    ns:20977322 nr:0 dw:10574 dr:20970957 al:7 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0

我重新启动后它就进入无盘状态。

[root@linclust1 ~]# cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 1AEFF755B8BD61B81A0AF27
 0: cs:Connected ro:Secondary/Secondary ds:Diskless/UpToDate C r-----
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0

文件如下drbd00.res

resource drbd00 {

        device /dev/drbd00;

        disk /dev/shared1/shared1; <=== This is an lvm device

        meta-disk internal;

        syncer {

           verify-alg sha1;

        }

        on linclust1.localdomain {

                address 192.168.31.101:7789;

        }

        on linclust2.localdomain {

                address 192.168.31.102:7789;

        }

      }

答案1

好的,我找到了问题所在。我尝试将其作为文件系统挂载,并通过 lvm 名称引用它,这使其变为无盘。我需要使用 /dev/drbd0 挂载它。这样就没问题了。

相关内容