Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a fileserver that I just setup lvm on. I have two LVM partitions /dev/fileserverLVM/home /dev/fileserverLVM/backup

I'd like to take and store the snapshots in /dev/fileserverLVM/backup. The stuff I've read all has you creating a new logical partition. Can this be avoided and the snapshot written directly to /dev/fileserverLVM/backup? Or do I have no options?

share|improve this question

3 Answers 3

I wanted this to be a comment to but the formatting in comments is unreadable so:

The other thing to remember is that you want to use a file system that can be quintessed ( see xfs _freeze , xfs _freeze -u ) before the snap shot so the correct set would be:

  • Freeze filesystem
  • Take a snapshot
  • Thaw filesystem
  • mount the snapshot filesystem, if you want to make a filesystem backup
  • then copy your data to your backup filsystem
  • unmount the filesystem if you had mounted it.
  • then remove the snapshot.
share|improve this answer
    
You don't have to freeze the filesystem, that's the beauty of LVM snapshots (and the VSS it's modeled after) –  Malfist Jul 15 '09 at 13:07
    
You do otherwise the filesystem will be inconsistent, it will only be crash consistent. –  James Jul 15 '09 at 15:01
    
Wikipedia mentions that "Since Linux 2.6.29 ext3, ext4, gfs2 and jfs have the freeze feature as well". Commit Log –  intuited Feb 18 '11 at 3:54

No that isn't really an option..

What you could to achieve this behavior is something like this.

  • Take a snapshot
  • mount the snapshot filesystem, if you want to make a filesystem backup
  • then copy your data to your backup filsystem
  • unmount the filesystem if you had mounted it.
  • then remove the snapshot.

The important thing to remember is that you must have enough free physical extents in your volume group to accomplish this.

See snapshot backup section of the LVM HOWTO.

A snapshot volume can be as large or a small as you like but it must be large enough to hold all the changes that are likely to happen to the original volume during the lifetime of the snapshot.

share|improve this answer

Snapshot is the volume of it's own by definition, so it must be added to Volume Group as it.

If you want an almost instant copy of the working home LV within your backup LV using snapshots, you can proceed as follows:

  • create snapshot of live volume

lvcreate -LXG -s -n snapshot /dev/fileserverLVM/home

  • assuming backup LV is of the same size as home

dd if=/dev/fileserverLVM/snapshot of=/dev/fileserverLVM/backup bs=1M

  • remove the snapshot

lvremove /dev/fileserverLVM/snapshot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.