I need help setting up LVM snapshots on Ubuntu 16.04


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu I need help setting up LVM snapshots on Ubuntu 16.04
# 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_screenshotpng
# 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to create LVM snapshots?

Please suggest me how do I create LVM snapshots in linux. Best regards, Vishal (5 Replies)
Discussion started by: admin_db
5 Replies

2. UNIX for Dummies Questions & Answers

Setting environment variable problem in Ubuntu?

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... (1 Reply)
Discussion started by: gbdaw
1 Replies

3. UNIX for Dummies Questions & Answers

How to convert non LVM root partition to LVM?

Hi Guys, I m using redhat 6, I have installed root partition as non-LVM . Is there any way i can convert it to LVM? (1 Reply)
Discussion started by: pinga123
1 Replies

4. UNIX for Advanced & Expert Users

setting up ubuntu server as real time

0 down vote favorite share share share Let's solve my case please, it's urgent I have installed ubuntu server 11.04 on a machine with size 4GB. As, the ubuntu server 11.04 does not support real time kernel by default, I ... (0 Replies)
Discussion started by: dr_mabuse
0 Replies

5. Emergency UNIX and Linux Support

Is this how LVM snapshots work?

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... (3 Replies)
Discussion started by: majid.merkava
3 Replies

6. UNIX for Dummies Questions & Answers

mplayer snapshots

I have a script with: mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=320:height=240:norm=NTSC:fps=30:noaudio:input=0 -vf screenshot -aspect 4:3 -vo xv to take .png screenshots. It now works but am not getting what the webcam sees displayed in the frame -- just snow noise. Does someone... (1 Reply)
Discussion started by: slak0
1 Replies

7. Shell Programming and Scripting

Setting alias for a user - Linux ubuntu

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 {}" ... (3 Replies)
Discussion started by: joycesolomon
3 Replies

8. HP-UX

How to reduce LVM to create another LVM

Hi, I'm new to HP-UX. I have LVM on /var with 92Gig. I would like to reduce it to create another LVM for Oracle client with 800 meg or so. How to do it. I'm running 11.iv3 Thanks (4 Replies)
Discussion started by: lamoul
4 Replies

9. Solaris

snapshots syntax

Hi guys, i am intrested to learn about snapshots. I was a bit confused about snapshot i know using fssnap -F ufs -o bs (i dont understand the exact what to give the path after this ) if any one know the proper syntax..pls help me. (2 Replies)
Discussion started by: kurva
2 Replies

10. Filesystems, Disks and Memory

Problem setting up raw partitions on SUSE v8.0 using LVM on Oracle 8.1.7.URGENT!!!!!!

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... (2 Replies)
Discussion started by: Amitstora
2 Replies
Login or Register to Ask a Question