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

Re: distro for 486 with 32 MB ram



Michael Pobega wrote:
On Wed, Mar 21, 2007 at 03:15:09PM +0800, Bob wrote:
What do people use for mirroring Linux partitions, tar probably but is there a better tool?
Why is it better?


I've heard of the dd command being used, but I'm not really too
knowledgable in that field. But if someone really needs to do it, I'd
just check the dd manpage.



The 'tar' command does not 'mirror' a partition. It creates an archive of files located at some point in a file system hierarchy and down. So, it can cross 'partition' boundaries, assuming they are mount points.

Partition level backups can be done with backup/restore, but even these are not technically 'mirrors', though they come close.

A mirror is a bit for bit copy of something, in this case a partition, and can only be done with a tool like 'dd' or RAID software/hardware configured to create a mirror device.

'dd' has a multitude of features and reading the man page can become rather confusing. The basic command you need is:

    dd if=/dev/xxx of=/path/to/file

But this is not very efficient, since the default 'block' size is 512 bytes. The following will take advantage of both RAM free space for buffering the I/O and of hard disk read/write hardware efficiencies:

    dd if=/dev/xxx of=/path/to/file bs=1024k

As for what the options mean: 'if' is 'input file' and points to the name of the hard disk partition you're imaging. 'of' is the 'output file' and points to the destination. In my example, this is a regular file, which implies a destination with enough space to hold such an object. But, this can also be the name of a destination partition, which must be *at least* as big as the source, though it may be larger (which means lost space). And, 'bs' stands for 'block size', the amount of data read at one time, then written. In the example this is 1 MB. There are also 'ibs' and 'obs' options to set the 'input' and 'output' block sizes, if you need different values.

If you have older disks that use the old sector/track/cylinder designations (not linear mode addressing), then the 'bs' value should be set to the number of bytes(k bytes, m bytes) in a track or cylinder. With linear addressing, the size is not determined by the hard disk so much as it is by available RAM. So, the 'bs' selected should not be too large as compared to available RAM. You definitely don't want 'dd' to force the system into using swap. And if you use the 'ibs' and 'obs', it would probably improve efficiency a little if the values are kept aligned, as in one is an exact multiple of the other (512k and 2048k, for example).

And, a *major* note of caution: the partition you're copying *MUST NOT BE MOUNTED!!* Booting from a rescue CD is the best choice, so nothing is mounted from the hard disk. If you can't do this and must boot to the hard disk, go to single user (maintenance) mode to do it. If you're working with the root partition, you must be sure it is mounted read only:

    mount -o remount,ro /

I hope this is good enough to get you going.

Bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: