Re: DD Command question
- From: "joe" <joe@xxxxxxxx>
- Date: Sat, 30 Jun 2007 16:18:38 +0100
"Roby" <roby@xxxxxxxxxxxxxx> wrote in message
news:46866ac3$0$3096$4c368faf@xxxxxxxxxxxxxxxxx
joe wrote:
Just started using Linux, so forgive my newbiness.
Lets say I have 1 hard disc (HDA) with only 1 partitioin (HDA1), and I
wanted to DD only the first 300MB into an arbritary folder. What DD
command would I need to copy the first 300MB of HDA and how would this
differ from DD`ing the first 300MB of HDA1 ?
Thanks in advance.
Welcome to the world of linux, Joe!
"hda" refers to the entire drive, starting with the master boot record
that
is located in the first sector and including your hda1 partition that
follows. "hda1" begins with its own boot record followed by your files
(and
unallocated sectors). You direct dd to start somewhere and process all of
the bytes within a specified range or leave out the range and allow dd
continue on to the end of the disk. It doesn't know or care whether the
bytes are data or just slack space: everything in the path is processed.
That's a lot different than a file copy operation.
To copy the first 1024 bytes of hda1 to a file save-this in the current
default directory, you could set blocksize to 1024 and do one move:
# dd if=/dev/hda1 of=save-this bs=1024 count=1
... or copy two sectors:
# dd if=/dev/hda1 of=save-this bs=512 count=2
dd counts bytes, so you need to choose the blocksize and count values that
multiply out to your meaning of "300MB" (i.e., 300*1024*1024 or 3*10^8).
In either case, the resulting file will likely contain less than "300MB"
of data due to the slack space dd includes.
BE REALLY-REALLY CAREFUL!! dd is powerful. Screw up when typing in the
command and you will be appropriately rewarded. (Read this again.)
Having linux installed on an old clunker machine is a great place to
experiment without risking learning-curve damage to your good install.
Oh. And read the dd man page too!
Many thanks, Lew and Roby, much clearer now.
So DD`ing firstly the full MBR, then 300Mb of DHA1 would be identical to
DD`ing 300Mb (+512 of MBR) of HDA ?
Again, many thanks.
.
- References:
- DD Command question
- From: joe
- Re: DD Command question
- From: Roby
- DD Command question
- Prev by Date: Re: DD Command question
- Next by Date: Re: DD Command question
- Previous by thread: Re: DD Command question
- Next by thread: Re: DD Command question
- Index(es):
Relevant Pages
|
|