Re: Creating Image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Douglas wrote:
> I want to create an image of my current FC server for quick restore.
> 
> I have a USB  drive.
> 
> What command do I use to format the USB drive?
> 
> What command should I use to create the image?

Dan wrote:
> To create an exact copy of a partition, providing you create a partition 
> of the exact same or larger size on the USB drive:
> dd if=/dev/hda1 of=/dev/sda1 bs=16M
> where /dev/hda1 is the partition you wish to back up and /dev/sda1 is 
> the backup partition. To restore, simply switch the parameters used for 
> of and if.

This is more or less the way I'd do it, assuming that the USB drive is
at least as large as the partition you want to back up. It has a problem
in that you won't get any compression, and you have to back up the whole
thing (including blank space). But you will get any boot sector you've
installed.

Speaking of which, do make sure to get the MBR, especially if you've
installed grub there.
dd if=/dev/hda of=/media/usbdisk/mbr.image bs=512 count=1
should do that.

On the other hand, this will mean that if the drive fails, and you
restore to a larger hard disk, you *probably* won't be able to use the
extra space.

I might create a "normal" filesystem (probably ext3) on the filesystem
and dd if=/dev/hda1 of=/media/usbdrive/hda1.image so the image was kept
on a filesystem.

You might be able to do a lot better, depending on how the server is
partitioned. For example, if it's mainly a fileserver or a database
server and you have (say) a /data or a /share partition, you'd probably
find that both backups and restores went faster if you used tar zcf to
create a traditional .tar.gz backup. You'll use a lot less space on the
USB disk, too, which might mean you can keep more than one backup on
there.

You might want to do a snapshot of the server at a point in time, check
that, and say "restore is applying the snapshot, creating extra
filesystems, and restoring from the most recent .tar.gz". This still
might be quicker than one command that takes ages to run. (You'll do
well to get 40 MB/s consistently out of either drive. That's getting on
for two hours for a 250 GB drive.)

I'd almost certainly do the dd while booted from a rescue CD or a live
CD, though. I wouldn't want to trust that this would work reliably on a
mounted filesystem.

James.
-- 
E-mail address: james | DON'T be put off by "horror stories" spread by
@westexe.demon.co.uk  | others.  People who talk about death and serious
                      | injury are very rarely the ones who have actually
                      | suffered such things.  -- Adrian Plass


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux