<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">On Sun, 29 Jul 2018 1:13 am Eric Robinson <<a href="mailto:eric.robinson@psmnv.com">eric.robinson@psmnv.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
<br>
<br>
> -----Original Message-----<br>
> From: Eric Robinson<br>
> Sent: Saturday, July 28, 2018 7:39 AM<br>
> To: Lars Ellenberg <<a href="mailto:lars.ellenberg@linbit.com" target="_blank" rel="noreferrer">lars.ellenberg@linbit.com</a>>; <a href="mailto:drbd-user@lists.linbit.com" target="_blank" rel="noreferrer">drbd-user@lists.linbit.com</a><br>
> Subject: RE: [DRBD-user] drbd+lvm no bueno<br>
> <br>
> > > > Lars,<br>
> > > ><br>
> > > > I put MySQL databases on the drbd volume. To back them up, I pause<br>
> > > > them and do LVM snapshots (then rsync the snapshots to an archive<br>
> > > > server). How could I do that with LVM below drbd, since what I<br>
> > > > want is a snapshot of the filesystem where MySQL lives?<br>
> > ><br>
> > > You just snapshot below DRBD, after "quiescen" the mysql db.<br>
> > ><br>
> > > DRBD is transparent, the "garbage" (to the filesystem) of the<br>
> > > "trailing drbd meta data" is of no concern.<br>
> > > You may have to "mount -t ext4" (or xfs or whatever), if your mount<br>
> > > and libblkid decide that this was a "drbd" type and could not be<br>
> > > mounted. They are just trying to help, really.<br>
> > > which is good. but in that case they get it wrong.<br>
> ><br>
> > Okay, just so I understand....<br>
> ><br>
> > Suppose I turn md4 into a PV and create one volume group<br>
> > 'vg_under_drbd0', and logical volume 'lv_under_drbd0' that takes 95%<br>
> > of the space, leaving 5% for snapshots.<br>
> ><br>
> > Then I create my ext4 filesystem directly on drbd0.<br>
> ><br>
> > At backup time, I quiesce the MySQL instances and create a snapshot of<br>
> > the drbd disk.<br>
> ><br>
> > I can then mount the drbd snapshot as a filesystem?<br>
> ><br>
> <br>
> Disregard question. I tested it. Works fine. Mind blown.<br>
> <br>
> -Eric<br>
> <br>
<br>
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?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I think this can help properly understanding lvm snapshots and answer your question <a href="https://www.clevernetsystems.com/lvm-snapshots-explained/">https://www.clevernetsystems.com/lvm-snapshots-explained/</a></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Check it out...<br>
<br>
root@001db01a /]# lvdisplay<br>
--- Logical volume ---<br>
LV Path /dev/vg_under_drbd1/lv_under_drbd1<br>
LV Name lv_under_drbd1<br>
VG Name vg_under_drbd1<br>
LV UUID LWWPiL-Y6nR-cNnW-j2E9-LAK9-UsXm-3inTyJ<br>
LV Write Access read/write<br>
LV Creation host, time 001db01a, 2018-07-28 04:53:14 +0000<br>
LV Status available<br>
# open 2<br>
LV Size 1.40 TiB<br>
Current LE 367002<br>
Segments 1<br>
Allocation inherit<br>
Read ahead sectors auto<br>
- currently set to 8192<br>
Block device 253:1<br>
<br>
--- Logical volume ---<br>
LV Path /dev/vg_under_drbd0/lv_under_drbd0<br>
LV Name lv_under_drbd0<br>
VG Name vg_under_drbd0<br>
LV UUID M2oMNd-hots-d9Pf-KQG8-YPqh-6x3a-r6wBqo<br>
LV Write Access read/write<br>
LV Creation host, time 001db01a, 2018-07-28 04:52:59 +0000<br>
LV Status available<br>
# open 2<br>
LV Size 1.40 TiB<br>
Current LE 367002<br>
Segments 1<br>
Allocation inherit<br>
Read ahead sectors auto<br>
- currently set to 8192<br>
Block device 253:0<br>
<br>
[root@001db01a /]# df -h<br>
Filesystem Size Used Avail Use% Mounted on<br>
/dev/sda2 30G 3.3G 27G 12% /<br>
devtmpfs 63G 0 63G 0% /dev<br>
tmpfs 63G 0 63G 0% /dev/shm<br>
tmpfs 63G 9.0M 63G 1% /run<br>
tmpfs 63G 0 63G 0% /sys/fs/cgroup<br>
/dev/sda1 497M 78M 420M 16% /boot<br>
/dev/sdb1 252G 61M 239G 1% /mnt/resource<br>
tmpfs 13G 0 13G 0% /run/user/0<br>
/dev/drbd0 1.4T 2.1G 1.4T 1% /ha01_mysql<br>
[root@001db01a /]#<br>
[root@001db01a /]# ls /ha01_mysql<br>
lost+found testfile<br>
[root@001db01a /]#<br>
[root@001db01a /]# lvcreate -s -L30G -n drbd0_snapshot /dev/vg_under_drbd0/lv_under_drbd0<br>
Logical volume "drbd0_snapshot" created.<br>
[root@001db01a /]#<br>
[root@001db01a /]# mount /dev/vg_under_drbd0/drbd0_snapshot /ha01_mysql<br>
[root@001db01a /]#<br>
[root@001db01a /]# cd /ha01_mysql<br>
[root@001db01a ha01_mysql]# ls<br>
lost+found testfile<br>
[root@001db01a ha01_mysql]# echo blah > blah.txt<br>
[root@001db01a ha01_mysql]# ll<br>
total 2097172<br>
-rw-r--r--. 1 root root 5 Jul 28 14:50 blah.txt<br>
drwx------. 2 root root 16384 Jul 28 14:10 lost+found<br>
-rw-r--r--. 1 root root 2147479552 Jul 28 14:20 testfile<br>
[root@001db01a ha01_mysql]# cd /<br>
[root@001db01a /]# umount /ha01_mysql<br>
[root@001db01a /]# ls /ha01_mysql<br>
lost+found testfile<br>
[root@001db01a /]#<br>
<br>
What? I know nothing.<br>
<br>
--Eric<br>
_______________________________________________<br>
drbd-user mailing list<br>
<a href="mailto:drbd-user@lists.linbit.com" target="_blank" rel="noreferrer">drbd-user@lists.linbit.com</a><br>
<a href="http://lists.linbit.com/mailman/listinfo/drbd-user" rel="noreferrer noreferrer" target="_blank">http://lists.linbit.com/mailman/listinfo/drbd-user</a><br>
</blockquote></div></div></div>