HowTo: LVM


[Top] [Contents] [Index] [ ? ]

How to clon a system with logic volumes LVM

How to clon a system with logic volumes LVM

Copyright © 2008 Joan Lledó

Copyright (C) 2008 Joan Lledó. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. http://www.gnu.org/licenses/fdl-1.2.txt.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Introduction


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 ¿Qué es LVM?

LVM (Logical Volume Manager) is an administration system of logical volumes in Linux. This system can create and manage "virtual" partitions instead of partition the HDD. These partitions are called “Logical Volumes".

The primary advantages of using logical volumes are the following:
- They can be easily resized to save space.
- Allow using the space in one or several partitions; however they are in different hard disks; and create volumes as big as the addition of all partitions used.

Project web page: http://sourceware.org/lvm2/
Articles in Wikipedia with more information: http://en.wikipedia.org/wiki/Logical_volume_management
http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Why exists this how-to?

Due to with lvm you can save data in several partitions and those partitions can be in different hard disks, and gnetic only can work with a single HDD at the time, is necessary to do many operations to be able of cloning a system which is configured with lvm. The steps to follow are detailed next.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Steps to follow

To illustrate the process will take like an example a typical installation of Fedora in the HDD /dva/hda.
In this system, /dev/hda1 is a traditional partition mounted in /boot and containing the necessary files for the system to start up. This partition is out of the lvm group because GRUB cannot read lvm partitions.
The device /dev/hda2 is a partition without a file system and in this partition will be created logical volumes.
The system has two logical volumes (lvm). One which is used to for the system root and the other that is used like a SWAP partition.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 Create an image or be a transmitter

These steps must be followed when you have a system with lvm and you want to do a security copy or you want to send it over the net.

1.- Create an image with a structure of the partitions (without data) of all the hard disks that uses the system, using no-data option. In Fedora case it will be /dev/hda.
gnetic -cd /dev/hda -f /mnt/hdb1/fedora-nodata.dna -n
2.- Create an image of the partitions that are out of LVM. In this case only /dev/hda1.
gnetic -cd /dev/hda1 -f /mnt/hdb1/fedora-hda1.dna
3.- Activate the logic volumes.
vgchange -a y
4.- Create an image of logical volumes with data.
gnetic -cd /dev/VolGroup00/LogVol00 -f /mnt/hdb1/fedora-LogVol00.dna


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Restore an image or be a receiver

These steps must be followed when you have images of a system that was using LVM and you want to restore it.

1.- Restore no-data images from hard disks that the system was using. In Fedoras example, only /dev/hda
gnetic -rd /dev/hda -f /mnt/hdb1/fedora-nodata.dna
2.- The previous command restores the LVM configuration that the hard disks had; now you can activate LVM.
vgchange -a y
3.- Restore images from logical volumes with data that the system had.
gnetic -rd /dev/VolGroup00/LogVol00 -f /mnt/hdb1/fedora-LogVol00.dna
4.- Fedora uses LogVol01 for SWAP partition, for that reason this partition must be formatted like SWAP.
mkswap /dev/VolGroup00/LogVol01
5.- Restore images from partitions that are outside of LVM. In Fedora case, only /dev/hda1
gnetic -rd /dev/hda1 -f /mnt/hdb1/fedora-hda1.dna
6.- In case that the boot loader was GRUB, gnetic allow us restore it; for that we must specify the partition where the GRUB files are and the device where we want to install GRUB.
gnetic -g /dev/hda1 -d /dev/hda


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Author

Joan Lledó joanlluislledo@gmail.com


[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated by Joan Lledó on May, 25 2008 using texi2html 1.78.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back Previous section in reading order 1.2.2
[ > ] Forward Next section in reading order 1.2.4
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ Up ] Up Up section 1.2
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:

  • 1. Section One
    • 1.1 Subsection One-One
      • ...
    • 1.2 Subsection One-Two
      • 1.2.1 Subsubsection One-Two-One
      • 1.2.2 Subsubsection One-Two-Two
      • 1.2.3 Subsubsection One-Two-Three     <== Current Position
      • 1.2.4 Subsubsection One-Two-Four
    • 1.3 Subsection One-Three
      • ...
    • 1.4 Subsection One-Four

This document was generated by Joan Lledó on May, 25 2008 using texi2html 1.78.

Valid HTML 4.01 Transitional Valid CSS!