Results 1 to 10 of 12

Thread: How would you go about saving and restoring your root directory?

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Beans
    4,699

    How would you go about saving and restoring your root directory?

    I have Ubuntu Server 12.04.1 running. The OS is split up on a 500 GB HDD.

    20 GB = /
    Remainder = /media/primary_drive

    I want to back up the root partition only. My intention is to capture that partition and have it be restore-able to another drive.

    Scenario 1 = Root HDD dies. Install a new HDD of any size that's larger than 20 GB, whether it be 40, 160, 320, 1 TB, etc. Restore the image, boot up, everything just works.

    Scenario 2 = In time, I want to replace the HDD with an SSD. I want to install the SSD, restore the image, boot up, and everything just works.

    I'm just a little unsure of how to go about this and what the best solution is. Some discussions with other users has kind of ruled out "DD" from the equation due to DD being block level, and my intention of someday going to an SSD kind of nullifies that. Is Clonezilla Live my best bet? Can CZ Live restore singular partitions (like / in my case) and bingo, it boots up fine? Or should I result to some sort of CLI command, like cp or tar?

    Overall, just curious what you guys use and what you recommend. Need some more food choices on the table before I pick the main course.
    HOW TO - Set up video surveillance with "Motion"

    Buying a Lenovo? Do your research first!
    Some Lenovos have a whitelisted BIOS which prevents you from changing the wifi card.

  2. #2
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: How would you go about saving and restoring your root directory?

    The file system used would impact which imaging tool was used. EXT4 is not well supported. Ext2 and EXt3 are well supported by partimage and will only store actual data. I've used dd and ddrescue more than a few times when moving to new HDDs, but with all the migrations from 512b sector disks to 4K sector disks, I don't see this as a viable option anymore.

    OTOH, why use an image at all? Use any backup tool and just exclude everything under /media from the backups. I use rdiff-backup, but Deja-Dup, Duplicity, Duplicati, or even rsync can easily do what you need. Automatic, versioned, backups are critical for data security even if you never lose any files.

    Another alternative is not to bother backing up the OS and apps at all. Just backup the settings, data, and keep a record of the installed apps using dpkg --get-selections > file.out. When you need to restore, install the base OS like normal, then use dpkg --set-selections < file.out torestore the apps.Simple.Image backups are for Windows, not Linux, IMHO.

  3. #3
    Join Date
    Jul 2006
    Beans
    4,699

    Re: How would you go about saving and restoring your root directory?

    Thanks for the insight. I currently have my entire /etc directory getting tar'd nightly and backing up, since after all the vast majority of my configs exist there. Doing this just got me curious that it'd be nice to have a ready-to-go image to plop on a drive and get going in an instant if need be. I know what you're saying that imaging is typically a Windows thing, but if it can be done here, it would still undoubtedly be helpful.
    HOW TO - Set up video surveillance with "Motion"

    Buying a Lenovo? Do your research first!
    Some Lenovos have a whitelisted BIOS which prevents you from changing the wifi card.

  4. #4
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: How would you go about saving and restoring your root directory?

    You can image any HDD using clonezilla or partimage. The compression will just be dumb, unlike with ext3 and ext2 where the compression will be file-system aware. Basically, dumb means every bit gets added to the image AND the restore since it uses `dd` internally.

    We all need backups, so why not have backups be your normal recovery method? Why have something "special" for some other reason? Backups are extremely space and time efficient. No reason to use tar anymore.

  5. #5
    Join Date
    Jul 2006
    Beans
    4,699

    Re: How would you go about saving and restoring your root directory?

    What would you personally use for backups? I'm currently using rsync to synchronize raw data to another drive (external HDD). I'm actually prepping a Raspberry Pi now to be in another area of the house and run 24/7 to handle this job. That way my "backup" isn't directly attached to the server. This has always been my preferred method since rsync works beautifully to local USB drives or remote servers in the house/state/country. Plus it's relatively easy to whip up a bash script to run nightly via cron.

    I understand the whole backup mentality and I understand that imaging may not always be the conventional backup method for Linux, but then this question comes to mind in which I'm curious what your answer would be. Let's say you want to do a drive migration, where you want your current server off of the current drive and installed to a new drive. How would you go about doing that? Just back up /var, /etc, and whatever else and then do a fresh OS install, then bring the configs back over?

    Thanks for your insight!
    HOW TO - Set up video surveillance with "Motion"

    Buying a Lenovo? Do your research first!
    Some Lenovos have a whitelisted BIOS which prevents you from changing the wifi card.

  6. #6
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: How would you go about saving and restoring your root directory?

    I use rdiff-backup.
    I have restored using it multiple times. Restored 1 file or entire OSes.

    I've written about this on my blog.jdpfu.com multiple times, including techniques for non-full system backups (doing the settings and data only method). I've used that too AND restored 100% successfully.

    rsync is not usually the best tool for backups. It is a fine tool to mirror disks AFTER the file system has been built. Again, why have 2 solutions - mirror and backup. If you don't trust your backups that much, then you need a different backup method, right?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •