Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Drive Salvage


SystemRescueCd

SystemRescueCd (SRCd), available at www.sysresccd.org, is a bootable CD with the tools required to diagnose, back up, and restore a system. I've also put SRCd on a 256-MB bootable USB stick.

You can use the fb1280 kernel on any system with a decent display and, because most PCs have enough memory for the entire 100-MB CD image, you can also specify cdcache to speed things up. SRCd starts off with a garish character-mode display, but on the other hand, it's not particularly fussy about the underlying hardware, which is precisely what you want in a rescue program. With SRCd booted, net-setup eth0 configures nearly any NIC for either DHCP or a specific IP address. Run ifconfig to verify that it's set up the way you want, ping another box to be sure you have the network cable plugged in, then run /etc/init.d/nfs start to enable remote mounting.

You probably already have a PC set up with an NFS- or SMB-shared hard drive, and if not, you should. Listing One shows what you need to mount an NFS drive at /mnt/temp1 in the SRCd filesystem. Actually setting up the server is straightforward and well documented, at least after you understand UNIX-style file permissions.

run_qtparted                # create the partitions on the drive
net-setup eth0               # define IP address and suchlike
/etc/init.d/nfs start         # also fires up portmapper, lockd, etc
mount 192.168.1.2:/bulkdata /mnt/temp1        # mount the NFS share from the server
cd /mnt/bulkdata/Backups/Dim4550              # directory for these partition images
partimage restore /dev/hda1 WinXP-hda1.000 # restore the first partition
Listing One

Creating partitions on a drive is straightforward: run_qtparted starts a graphical partitioning program. I prepared an NTFS partition for Windows XP, a swap partition, an ext2 partition for Debian, and an ext3 partition for SuSE that filled the rest of the drive because I planned to have our daughter reinstall SuSE from scratch.

The partimage program saves and restores partition image files with optional compression to reduce the file size. It can use files on a different hard drive or partition, run in client-server mode with another partimage on the machine with the image files, or restore directly from an image file on CD or DVD. Using an NFS share works nicely with my setup.

If you want to restore a partition's original contents into a larger partition, create the new partition at its original size, restore the image file, then resize the partition with QTPartEd. Yes, it works with NTFS.

Filling a partition's unused space with binary zeros dramatically reduces the space required for a compressed image file. Mount the partition (mount /dev/hda1 /mnt/part), create the file (cp /dev/zero /mnt/part/dummy), delete it (rm /mnt/part/dummy), then proceed with the partimage backup.

Obviously, this level of detailed control doesn't scale well to large installations, but overall it's no more effort for me than commercial software. The benefit comes from knowing how things work, which pays off when the support-line phone rings.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.