I need help setting up LVM snapshots on Ubuntu 16.04

Tags
mariadb ubuntu snapshot, ubuntu

 
Thread Tools Search this Thread
# 1  
Old 09-07-2016
I need help setting up LVM snapshots on Ubuntu 16.04

I am running Ubuntu 16.04 on a HP laptop with a core I3 processor. I am trying to run mariaDB and do hot backups to disk. In order to do that I wanted to create an LVM snapshot and backup the snapshot for a point in time backup, possibly using tar. I included a snapshot of the gparted app showing the volumes that I created.

Here is the OS info:

Code:
$: cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial

Here is the output of pvdisplay:

Code:
$: /dev/mapper# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               mysql_backup
  PV Size               97.79 GiB / not usable 0   
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              25033
  Free PE               25033
  Allocated PE          0
  PV UUID               pYsATM-Sa7g-DHXL-YsxY-u773-eeuK-O2AmEd
   
  --- Physical volume ---
  PV Name               /dev/sda4
  VG Name               mysql_data
  PV Size               97.79 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25033
  Free PE               0
  Allocated PE          25033
  PV UUID               UzE6c9-JhGh-nthP-9qvd-0Oi1-GMdy-ifwo3c
   
  --- Physical volume ---
  PV Name               /dev/mapper/sda3_crypt
  VG Name               ubuntu-vg
  PV Size               500.10 GiB / not usable 1.40 MiB
  Allocatable           NO
  PE Size               4.00 MiB
  Total PE              128025
  Free PE               9
  Allocated PE          128016
  PV UUID               6b62NM-FzeS-kOsG-utXD-ysci-NRMJ-Xgw0cw

Here is the output of the lvdisplay:

Code:
:/dev/mapper# lvdisplay
  --- Logical volume ---
  LV Path                /dev/mysql_data/lvroot
  LV Name                lvroot
  VG Name                mysql_data
  LV UUID                ta5S3W-GLh2-FI6q-Ofhd-Pz8k-yvIe-RLR6xj
  LV Write Access        read/write
  LV Creation host, time Buck, 2016-08-31 22:43:59 -0400
  LV Status              available
  # open                 1
  LV Size                97.79 GiB
  Current LE             25033
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
   
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                c9xNwX-ucFB-VL29-h0E1-99oa-pcdx-d6pHVV
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-06-24 23:16:33 -0400
  LV Status              available
  # open                 1
  LV Size                500.00 GiB
  Current LE             128000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:3
   
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                yJwGxd-GNbd-YhXg-24sS-4GR9-T258-HfJ5RH
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-08-06 23:24:33 -0400
  LV Status              available
  # open                 0
  LV Size                64.00 MiB
  Current LE             16
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:4

My intent was that the volume /mysql_backup is the snapshot. I would like to make this into a backup script that I could run on demand and practice backup and recovery so that I could hopefully support mariaDB databases as a DBA. I just need to know how to setup the snapshot. I have looked through numerous websites trying to get it set up and I seem to be going in circles. Please let me know if there is something I did not explain properly. Thanks.
I need help setting up LVM snapshots on Ubuntu 16.04-gparted_screenshot-png
# 2  
Old 09-08-2016
The creation of snapshot is usually with lvconvert for Linux systems. Others use a variety of other LVM commands.

Does the database not include the hot-backup functionality itself? It would be better to use that if you can. Have a look at Backup and Restore Overview - MariaDB Knowledge Base to see if that provides a better plan.

The problem you will have with LVM snapshots is being sure you have the correct definition of your process. The phrasing can be confusing in what it delivers and how. If you have a high-rate update database then some snapshots can expire before your backup completes.

Do you want to really make a copy of the LV, mount that elsewhere and backup from there? You might have a problem in ensuring that the snapshot is a true reflection of a point in time if there are multiple LVs in use for the DB.

Is this the only way?



Robin

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to create LVM snapshots? admin_db UNIX for Dummies Questions & Answers 5 02-05-2015 04:49 PM
Permissions to run ZFS Snapshots AndyG Solaris 4 09-05-2013 12:15 PM
Setting environment variable problem in Ubuntu? gbdaw UNIX for Dummies Questions & Answers 1 05-12-2013 05:54 AM
How to convert non LVM root partition to LVM? pinga123 UNIX for Dummies Questions & Answers 1 04-17-2012 10:39 PM
setting up ubuntu server as real time dr_mabuse UNIX for Advanced & Expert Users 0 03-01-2012 08:05 PM
Is this how LVM snapshots work? majid.merkava Emergency UNIX and Linux Support 3 04-06-2011 05:58 PM
mplayer snapshots slak0 UNIX for Dummies Questions & Answers 1 08-24-2010 02:45 AM
Setting alias for a user - Linux ubuntu joycesolomon Shell Programming and Scripting 3 08-21-2010 07:52 AM
How to reduce LVM to create another LVM lamoul HP-UX 4 11-23-2009 11:11 AM
snapshots backup kurva Solaris 4 03-14-2009 07:36 PM
snapshots syntax kurva Solaris 2 03-05-2009 04:52 AM
Problem setting up raw partitions on SUSE v8.0 using LVM on Oracle 8.1.7.URGENT!!!!!! Amitstora Filesystems, Disks and Memory 2 10-09-2006 02:30 AM