Yogesh Ashok Powar

Personal Blogs

  • Feed Subscribe
  • Every Byte Matters

    howto on recovering GNU/Linux with LVM

    Tags: GNU/Linux OS

    Every Byte Matters

    If you have more than one machine then it’s always better to run these with the same version of the operating system. Provided all the machines have the same architecture.

    I have three identical setup running Gnu Debian Linux 8.

    Main reason for running these with Gnu Debian are

    Best way to install the OS is via netboot; that way one dont have to download large size ISO or DVD images, which any ways need to upgrade post installation.

    To save more on the Internet bandwidth, configure the system only once for a machine and later replicate the image on another.

    This is how I did the same

    1.  Have a separate LVM logical volume for root or slash or / and install the OS in it.
    2.  Use dd to create the image of the entire logical volume
    3.  On the new machine, boot from the netboot image. Create a LV partition of the same size and copy the entire image as is.
    4.  Then mount relevant partitions. Mount /proc, /dev, /sys and chroot into it. Details for steps.
    5.  Finally grub install and boot into identical Gnu/Linux.

    Lets say on one of the machine you installed ‘Latex’ and you want to replicate the same on other machine/s

    1.  Find out the exact packages that were installed. See /var/log/apt/history.log
    2.  Copy these .deb packages from the cache. The cache is maintained at /var/cache/apt/archives
    3.  Copy it on new machine and blindly perform dpkg -i *

    There is another better way to create the Debian repository of the cached  packages and access it over the network from the other machine. I remember doing that once for the Archlinux.

    These methods might not be the optimal way to get things done but they work just fine for isolated and/or low-bandwidth Internet setups.


    Tags: GNU/Linux OS
    Updated on: 2016-06-30