LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-19-2009, 08:18 AM   #1
tao_0077
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Rep: Reputation: 0
Backupping with LVM snapshot


hi guys

i'm using CentOS 5.4 having data disk on xfs file system.
i decided to use xfs because xfs have "xfs_freeze" command, i heard that it make me backup disk with LVM snapshot, without stopping server software.
but now a days,i heard that we need not xfs_freeze even while LVM snapshot is allocating.

so i have question...
Does LVM snapshot take all care of freezing file system now? or even other fs(ext3)?
do i need not to think about file cache or process opening file on fs ?

if so, can i backup disk with using lvm snapshot without any (stopping servers, or becoming single user mode) care on ext3?
 
Old 11-19-2009, 12:46 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
LVM doesn't care what filesystem it contains. It just takes a view of the disk at a given point in time, and writes all delta changes to that disk to spare space, providing two views of the same disk, one old snapshot, one live one. Basically the snapshot is in a crashed state, nothing is cleaned up or anything, so if your applications don't like recovering from a crashed state, you would want to close or flush them first.
 
Old 11-20-2009, 04:11 AM   #3
tao_0077
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
so, there are no safety way to backup live linux box?
hmmm.. so it means i dont have any benefit using snapshot....
 
Old 11-20-2009, 04:52 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by tao_0077 View Post
so, there are no safety way to backup live linux box?
hmmm.. so it means i dont have any benefit using snapshot....
There is no safe way to back up any system on-the-fly that has not been specially designed for it. You would need to snapshot the entire machine state including memory, CPU registers and file systems. That is the Eldorado of the forensics people.

For performance reasons file systems are write-cached. Files are written not to disk but to memory for flushing to disk at a convenient later time. The synch command exists to flush write caches and should be used after quiescing the system and before taking a backup.

Many applications write data to more than one file which takes time. If an application has written to one file and not to an associated other file then the data is inconsistent. "Data skew" exists. Databases are commonly like this. That's why online database backups are done using special database tools that effectively snapshot the database (after completing all current transactions) rather than by backing up their files directly.

All of which does not make snapshots useless -- it simply details some of their limitations. The usual backup-with-snapshot method is to stop active applications, take the snapshot, restart applications, do the backup, verify the backup against the snapshot and finally drop the snapshot.

In that scenario there are two great benefits of using snapshot. Firstly the applications are down for a minimum time. Secondly verification is practicable. Without snapshots verification is seldom practicable. Almost certainly some files will have changed during backup and it takes a very knowledgable backup administrator significant time to run through a list of files that did not verify and identify which really did change and which indicate a backup data error.
 
Old 11-20-2009, 08:37 AM   #5
tao_0077
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Rep: Reputation: 0
thanks for your comment

yes. i know about the file system's law and that is not simple.and that is why i'm interested in LVM snapshot.
once apon a time, i used *nix system on IRIX just as one user (on that time, SGI is still a "Giant" in Workstation world), and i have to execute boring command when backuping my system, single, sync, sync, sync, tar, ...
and 20 years later, my job is now on web & mail system, and i have to handle trusted service.
im dissapointed that issue about backupping is not changed even many years past. system backup is big matter on server, but still we need stop service(i understand i should backup them on service individually).
why kernel or fs developper doesn't provide simple way to trustworthy backup ? i thought LVM snapshot is the answer for that, but it seem not.

many web page guided about backuping on LVM snapshot does not mentioned about this issue...
 
Old 11-20-2009, 12:53 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if a process doesn't sync to disk, the data is not on the disk. No matter how clever the disk is, if the data isn't there, you can't seriously blame it for not being able to back it up.
 
Old 11-21-2009, 03:03 AM   #7
rohitmehta
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Rep: Reputation: 1
How To Create Linux LVM In 3 Minutes


http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/



The most attractive feature of Logical Volume Manager is to make disk management easier in Linux! Basically, LVM allows users to dynamically extend or shrink Linux “partition” or file system in online mode! The LVM can resize volume groups (VG) online by adding new physical volumes (PV) or rejecting those existing PVs attached to VG.



A visualized concept diagram of the Linux Logical Volume Manager or LVM

In this 3-minutes Linux LVM guide, let’s assume that

The LVM is not currently configured or in used. Having say that, this is the LVM tutorial if you’re going to setup LVM from the ground up on a production Linux server with a new SATA / SCSI hard disk.

Without a luxury server hardware, I tested this LVM tutorial on PC with the secondary hard disk dedicated for LVM setup. So, the Linux dev file of secondary IDE hard disk will be /dev/hdb (or /dev/sdb for SCSI hard disk).

This guide is fully tested in Red Hat Enterprise Linux 4 with Logical Volume Manager 2 (LVM2) run-time environment (LVM version 2.00.31 2004-12-12, Library version 1.00.19-ioctl 2004-07-03, Driver version 4.1.0)!

How to setup Linux LVM in 3 minutes at command line?

Login with root user ID and try to avoid using sudo command for simplicity reason.

Using the whole secondary hard disk for LVM partition:
fdisk /dev/hdb

At the Linux fdisk command prompt,


press n to create a new disk partition,
press p to create a primary disk partition,
press 1 to denote it as 1st disk partition,
press ENTER twice to accept the default of 1st and last cylinder – to convert the whole secondary hard disk to a single disk partition,
press t (will automatically select the only partition – partition 1) to change the default Linux partition type (0×83) to LVM partition type (0×8e),
press L to list all the currently supported partition type,
press 8e (as per the L listing) to change partition 1 to 8e, i.e. Linux LVM partition type,
press to P display the secondary hard disk partition setup. Please take note that the first partition is denoted as /dev/hdb1 in Linux,
press W to write the partition table and exit fdisk upon completion.



Next, this LVM command will create a LVM physical volume (PV) on a regular hard disk or partition:
pvcreate /dev/hdb1

Now, another LVM command to create a LVM volume group (VG) called vg0 with a physical extent size (PE size) of 16MB:
vgcreate -s 16M vg0 /dev/hdb1

Be properly planning ahead of PE size before creating a volume group with vgcreate -s option!

Create a 400MB logical volume (LV) called lvol0 on volume group vg0:
lvcreate -L 400M -n lvol0 vg0

This lvcreate command will create a softlink /dev/vg0/lvol0 point to a correspondence block device file called /dev/mapper/vg0-lvol0.

The Linux LVM setup is almost done. Now is the time to format logical volume lvol0 to create a Red Hat Linux supported file system, i.e. EXT3 file system, with 1% reserved block count:
mkfs -t ext3 -m 1 -v /dev/vg0/lvol0

Create a mount point before mounting the new EXT3 file system:
mkdir /mnt/vfs

The last step of this LVM tutorial – mount the new EXT3 file system created on logical volume lvol0 of LVM to /mnt/vfs mount point:
mount -t ext3 /dev/vg0/lvol0 /mnt/vfs

http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/
To confirm the LVM setup has been completed successfully, the df -h command should display these similar message:

/dev/mapper/vg0-lvol0 388M 11M 374M 3% /mnt/vfs

Some of the useful LVM commands reference:

vgdisplay vg0
To check or display volume group setting, such as physical size (PE Size), volume group name (VG name), maximum logical volumes (Max LV), maximum physical volume (Max PV), etc.

pvscan
To check or list all physical volumes (PV) created for volume group (VG) in the current system.

vgextend
To dynamically adding more physical volume (PV), i.e. through new hard disk or disk partition, to an existing volume group (VG) in online mode. You’ll have to manually execute vgextend after pvcreate command that create LVM physical volume (PV).



http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/ http://funlinuxfun.blogspot.com/

Last edited by rohitmehta; 11-21-2009 at 03:04 AM.
 
Old 11-21-2009, 03:09 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Your post appears to be just you blindly reposting your own blog links just becuause someone mentioned LVM. The user is asking about snapshots and backups, you've not mentioned either word in your entire document. Well intentioned or not, this looks very much like spam to me. Please do not treat LQ.org in this way.
 
Old 11-25-2012, 10:43 AM   #9
jheengut
Member
 
Registered: Sep 2006
Location: Providence, Moka Mauritius
Distribution: Slackware, Lubuntu
Posts: 352
Blog Entries: 16

Rep: Reputation: 51
COW

Hi

There are no mentions of COW(Copy On Write).


Have anyone of you tested creating a snapshot(snapshot1) and then flush and sync and again creating a snapshot(snapshot2) ?

Then checked if there are any differences between snapshot1 and snapshot2.


Quote:
Originally Posted by tao_0077
i decided to use xfs because xfs have "xfs_freeze" command, i heard that it make me backup disk with LVM snapshot, without stopping server software but now a days,i heard that we need not xfs_freeze even while LVM snapshot is allocating.

Apparently, it is a feature unique to xfs, try btrfs instead or ZFS(on Linux).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Snapshot eldo Linux - Server 2 11-20-2009 04:10 AM
lvm snapshot using script Ammad Linux - General 2 11-15-2009 08:35 AM
linux lvm snapshot Ammad Linux - General 4 11-11-2009 09:01 AM
lvm snapshot Ammad Linux - General 1 02-18-2009 07:03 AM
About LVM Snapshot geethusari LinuxQuestions.org Member Intro 1 12-03-2007 07:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration