l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:07

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] backing up the master boot record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] backing up the master boot record

On Tue, 19 Jun 2001, Peter Jay Salzman wrote:
> i'd like to know how to backup the master boot record, but the trouble is
> that i don't know how "big" the mbr is.
> according to the lilo mini-howto:
> 	dd if=/dev/hda of=blah bs=446 count=1

That will work, but making it 512 will at least give you thte data for the
partition information save in the file too, and if you find you just need
you mbr reset, you can use dd from the save 512 bytes files and only write
the 446 bytes if the partiton info could have changed.

So, use the above if you only want mbr and not part info.

> according to some documents i've found on google:
> 	dd if=/dev/hda of=blah bs=512 count=1
> so is it 446 bytes or 512 bytes?

As above.

> also, a question about dd.  according to the man page, bs=BYTE tells dd to
> read and write BYTE bytes.  count=BLOCK tells dd to copy only BLOCK input
> blocks.
> what is a block?

A block is arbitratry as defined by "bs"

dd if=/dev/zero of=/tmp/zero1.txt bs=1 count=22

created a file (/tmp/zero1.txt)of nulls that is 22 blocks long where in
this case, 1 block is 1 byte and the file is also 22 bytes.

dd if=/dev/zero of=/tmp/zero2.txt bs=512 count=22
created a file (/tmp/zero2.txt)of nulls that is 22 blocks long where in
this case, 1 block is 512 bytes and the file is 11264 bytes long (22*512).

ibs and obs are assumed to be equal to bs unless otherwise specified.

Almost lastly, the following two would be expected to produce the
same output:

dd if=/dev/zero of=/tmp/zero1a.txt bs=22 count=1

dd if=/dev/zero of=/tmp/zero1b.txt bs=1 count=22

On the discussion of "block" it is abritray from one system to another and
from one application to another. Block sizes for FS are often powers of 2,
such as 256, 512, 1024 and often end on or near fractional decimals of k,
M or whatever, but with dd's "bs=" you specify the block size, and also
how may blocks (with count) and multiply the two together to find your
total bytes.

After the last, you can also use seek and skip with dd for moving past
block in the output or input files(one used for one, and the other used
for the other. This can be useful to allow you to just update and
overwrite your partition info part way through your disk without
over-writing your MBR.

Yet another last after last... if you are using a kernel before a 2.4
kernel and have that nasty 2Gb max size file limit, check out split(1).

Hey, I want to talk about dd more... dd is very cool.

Too bad everyone else beat me to this.


LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.