I need help setting up LVM snapshots on Ubuntu 16.04


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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_screenshotpng
# 2  
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
Login or Register to Reply

|
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
Please suggest me how do I create LVM snapshots in linux. Best regards, Vishal... UNIX for Dummies Questions & Answers
5
UNIX for Dummies Questions & Answers
Setting environment variable problem in Ubuntu?
gbdaw
I am trying to install timbl- memory based learner tools in ubuntu. it after unpacking the tar file it brings the following msg No package 'ticcutils' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you...... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers
Is this how LVM snapshots work?
majid.merkava
Hi guys. I'm confused how LVM snapshots work. Here is what i understood: 1. we have a Logical Volume holding our data. 2. we make a snap shot of it with this command: lvcreate -L 1000M -s -n backup /dev/vg01/lv013. mount the snap shot 4. take your backup 5. remove the snapshot --> in this...... Emergency UNIX and Linux Support
3
Emergency UNIX and Linux Support
Setting alias for a user - Linux ubuntu
joycesolomon
Hi i have a user "SYSTEM" i want to set the below command in his .profile for an alias: who | awk '{print $1}'| sed '/SYSTEM/d' | sed '/root/d' |xargs -i pkill -u {} i tried as below: alias stop = " who | awk '{print $1}'| sed '/SYSTEM/d' | sed '/root/d' |xargs -i pkill -u {}" ...... Shell Programming and Scripting
3
Shell Programming and Scripting
Problem setting up raw partitions on SUSE v8.0 using LVM on Oracle 8.1.7.URGENT!!!!!!
Amitstora
Hi all! Working on Oracle v8.1.7.0.0 with OS  as Suse v8.0 Linux. I had created LVM,linked raw devices to LVM as below: # for binding raw devices raw /dev/raw/raw1 /dev/oracle/sam_raw_system_251m raw /dev/raw/raw2 /dev/oracle/sam_raw_users_26m raw /dev/raw/raw3...... Filesystems, Disks and Memory
2
Filesystems, Disks and Memory