[DRBD-user] drbd+lvm no bueno

Eric Robinson eric.robinson at psmnv.com
Sat Jul 28 16:54:28 CEST 2018





> -----Original Message-----
> From: Eric Robinson
> Sent: Saturday, July 28, 2018 7:39 AM
> To: Lars Ellenberg <lars.ellenberg at linbit.com>; drbd-user at lists.linbit.com
> Subject: RE: [DRBD-user] drbd+lvm no bueno
> 
> > > > Lars,
> > > >
> > > > I put MySQL databases on the drbd volume. To back them up, I pause
> > > > them and do LVM snapshots (then rsync the snapshots to an archive
> > > > server). How could I do that with LVM below drbd, since what I
> > > > want is a snapshot of the filesystem where MySQL lives?
> > >
> > > You just snapshot below DRBD, after "quiescen" the mysql db.
> > >
> > > DRBD is transparent, the "garbage" (to the filesystem) of the
> > > "trailing drbd meta data" is of no concern.
> > > You may have to "mount -t ext4" (or xfs or whatever), if your mount
> > > and libblkid decide that this was a "drbd" type and could not be
> > > mounted. They are just trying to help, really.
> > > which is good. but in that case they get it wrong.
> >
> > Okay, just so I understand....
> >
> > Suppose I turn md4 into a PV and create one volume group
> > 'vg_under_drbd0', and logical volume 'lv_under_drbd0' that takes 95%
> > of the space, leaving 5% for snapshots.
> >
> > Then I create my ext4 filesystem directly on drbd0.
> >
> > At backup time, I quiesce the MySQL instances and create a snapshot of
> > the drbd disk.
> >
> > I can then mount the drbd snapshot as a filesystem?
> >
> 
> Disregard question. I tested it. Works fine. Mind blown.
> 
> -Eric
> 

Although I discovered quite by accident that you can mount a snapshot over the top of the filesystem that exists on the device that it's a snapshot of. Wouldn't this create some sort of recursive write death spiral?

Check it out...

root at 001db01a /]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_under_drbd1/lv_under_drbd1
  LV Name                lv_under_drbd1
  VG Name                vg_under_drbd1
  LV UUID                LWWPiL-Y6nR-cNnW-j2E9-LAK9-UsXm-3inTyJ
  LV Write Access        read/write
  LV Creation host, time 001db01a, 2018-07-28 04:53:14 +0000
  LV Status              available
  # open                 2
  LV Size                1.40 TiB
  Current LE             367002
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/vg_under_drbd0/lv_under_drbd0
  LV Name                lv_under_drbd0
  VG Name                vg_under_drbd0
  LV UUID                M2oMNd-hots-d9Pf-KQG8-YPqh-6x3a-r6wBqo
  LV Write Access        read/write
  LV Creation host, time 001db01a, 2018-07-28 04:52:59 +0000
  LV Status              available
  # open                 2
  LV Size                1.40 TiB
  Current LE             367002
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

[root at 001db01a /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  3.3G   27G  12% /
devtmpfs         63G     0   63G   0% /dev
tmpfs            63G     0   63G   0% /dev/shm
tmpfs            63G  9.0M   63G   1% /run
tmpfs            63G     0   63G   0% /sys/fs/cgroup
/dev/sda1       497M   78M  420M  16% /boot
/dev/sdb1       252G   61M  239G   1% /mnt/resource
tmpfs            13G     0   13G   0% /run/user/0
/dev/drbd0      1.4T  2.1G  1.4T   1% /ha01_mysql
[root at 001db01a /]#
[root at 001db01a /]# ls /ha01_mysql
lost+found  testfile
[root at 001db01a /]#
[root at 001db01a /]# lvcreate -s -L30G -n drbd0_snapshot /dev/vg_under_drbd0/lv_under_drbd0
  Logical volume "drbd0_snapshot" created.
[root at 001db01a /]#
[root at 001db01a /]# mount /dev/vg_under_drbd0/drbd0_snapshot /ha01_mysql
[root at 001db01a /]#
[root at 001db01a /]# cd /ha01_mysql
[root at 001db01a ha01_mysql]# ls
lost+found  testfile
[root at 001db01a ha01_mysql]# echo blah > blah.txt
[root at 001db01a ha01_mysql]# ll
total 2097172
-rw-r--r--. 1 root root          5 Jul 28 14:50 blah.txt
drwx------. 2 root root      16384 Jul 28 14:10 lost+found
-rw-r--r--. 1 root root 2147479552 Jul 28 14:20 testfile
[root at 001db01a ha01_mysql]# cd /
 [root at 001db01a /]# umount /ha01_mysql
[root at 001db01a /]# ls /ha01_mysql
lost+found  testfile
[root at 001db01a /]#

What? I know nothing.

--Eric


More information about the drbd-user mailing list