Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is dd different from cp?

464 views
Skip to first unread message

tmch...@my-deja.com

unread,
Jan 11, 2001, 4:05:34 AM1/11/01
to
I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it boots.
Could someone tell me the difference? What abt that bs and count
parameters that I see so often. How do those affect the transfer?

thanks.


Sent via Deja.com
http://www.deja.com/

Dries van Oosten

unread,
Jan 11, 2001, 6:33:14 AM1/11/01
to
On Thu, 11 Jan 2001 tmch...@my-deja.com wrote:

> I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
> and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it boots.
> Could someone tell me the difference?

man dd and man cp would give you a pretty good idea.
cp copies from file system to filesystem, dd copies from device to device.


> What abt that bs and count
> parameters that I see so often. How do those affect the transfer?

bs=block size, the device you copy to is a block device, you need to tell
it what the block size is that that device accepts. Count is how many of
these blocks.

>
> thanks.
>
>
> Sent via Deja.com
> http://www.deja.com/
>

Groeten,
Dries


Steve Pratt

unread,
Jan 11, 2001, 6:39:50 AM1/11/01
to
In article <93jt0q$k5l$1...@nnrp1.deja.com>, tmch...@my-deja.com wrote:
>I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
>and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it boots.
>Could someone tell me the difference? What abt that bs and count
>parameters that I see so often. How do those affect the transfer?
>

Basically, cp copies files between file systems, whereas dd copies raw
data between devices. What this means in your case is that the file you're
copying with dd is actually a disk image complete with boot sector etc.

BTW I notice you cp'd vmlinuz and dd'd vmlinux, is that a typo or is it the
cause of your problem (I can't remember which file is what 8-( )

Steve

Linxc

unread,
Jan 12, 2001, 12:57:12 AM1/12/01
to
The kernel image is a Disk mirror image files, so you can but use dd with
copy it.
<tmch...@my-deja.com> wrote in message news:93jt0q$k5l$1...@nnrp1.deja.com...

David

unread,
Jan 11, 2001, 11:15:36 AM1/11/01
to
tmch...@my-deja.com wrote:
>
> I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
> and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it boots.
> Could someone tell me the difference? What abt that bs and count
> parameters that I see so often. How do those affect the transfer?

It is possible to use "cp" to copy vmlinuz to a floppy. At least it
works if you use these steps.

fdformat /dev/fd0H1440

cp /boot/vmlinuz /dev/fd0

/usr/sbin/rdev
# Shows kernel root device such as "/dev/hda5"

/usr/sbin/rdev /dev/fd0 /dev/hdaX
# hdaX root device shown by command above.

/usr/sbin/rdev -R /dev/fd0 1
# This makes the root device read only

--
Confucius say: He who play in root, eventually kill tree.
Registered with the Linux Counter. http://counter.li.org
ID # 123538
Completed more W/U's than 98.992% of seti users. +/- 0.01%

tmch...@my-deja.com

unread,
Jan 11, 2001, 6:49:57 PM1/11/01
to
In article <Pine.OSF.4.31.01011...@ruunat.phys.uu.nl>,

Dries van Oosten <dvoo...@phys.uu.nl> wrote:
> On Thu, 11 Jan 2001 tmch...@my-deja.com wrote:
>
> > I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
> > and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it
boots.
> > Could someone tell me the difference?
>
> man dd and man cp would give you a pretty good idea.
> cp copies from file system to filesystem, dd copies from device to >
> device.

Huh? So does that mean I can dd an ext2 file to an msdos-formatted
floppy disk and it'll be ok?

> > What abt that bs and count
> > parameters that I see so often. How do those affect the transfer?
>
> bs=block size, the device you copy to is a block device, you need to
tell
> it what the block size is that that device accepts. Count is how many
of
> these blocks.

What if I leave out bs and count? Are there any default values that dd
uses? What if I want to copy /vmlinuz to a floppy (kernel image is 980
blocks, 1 block is 1024 bytes) and I added the wrong parameter values
like, say, bs=512 count=1024, how would it affect the dd? Would I still
be able to boot?

Is ls -b the way to find out the block size of a file?

tmch...@my-deja.com

unread,
Jan 11, 2001, 6:55:15 PM1/11/01
to
In article <3a5d9c40$1...@chlorine.cen.brad.ac.uk>,

s.p...@bradford.ac.uk (Steve Pratt) wrote:
> In article <93jt0q$k5l$1...@nnrp1.deja.com>, tmch...@my-deja.com wrote:
> >I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
> >and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it
boots.
> >Could someone tell me the difference? What abt that bs and count
> >parameters that I see so often. How do those affect the transfer?
> >
>
> Basically, cp copies files between file systems, whereas dd copies
raw
> data between devices. What this means in your case is that the file
you're
> copying with dd is actually a disk image complete with boot sector
etc.

Disk image complete with boot sector? You mean cp does not copy the
image to the boot sector and dd does? So that's why the image boots
with dd and not cp? Has this anything to do with the first 512 bytes of
a floppy? Sector 0?


> BTW I notice you cp'd vmlinuz and dd'd vmlinux, is that a typo or is
it the
> cause of your problem (I can't remember which file is what 8-( )

Sorry, it's a typo. I meant vmlinuz. The 'z' as in zipped. The kernel
is compressed, zipped, isn't it?

tmch...@my-deja.com

unread,
Jan 11, 2001, 6:57:57 PM1/11/01
to
In article <3A5DDC26...@hotmail.com>,

David <thunde...@hotmail.com> wrote:
> tmch...@my-deja.com wrote:
> >
> > I copied a kernel image to a floppy, cp /vmlinuz /dev/fd0
> > and it would not boot. I used dd if=/vmlinux of=/dev/fdo and it
boots.
> > Could someone tell me the difference? What abt that bs and count
> > parameters that I see so often. How do those affect the transfer?
>
> It is possible to use "cp" to copy vmlinuz to a floppy. At least it
> works if you use these steps.
>
> fdformat /dev/fd0H1440

Thanks. But I have to use superformat. fdformat is obsolete in Debian
potato. Can't use it.


>
> cp /boot/vmlinuz /dev/fd0
>
> /usr/sbin/rdev
> # Shows kernel root device such as "/dev/hda5"
>
> /usr/sbin/rdev /dev/fd0 /dev/hdaX
> # hdaX root device shown by command above.
>
> /usr/sbin/rdev -R /dev/fd0 1
> # This makes the root device read only
>
> --
> Confucius say: He who play in root, eventually kill tree.
> Registered with the Linux Counter. http://counter.li.org
> ID # 123538
> Completed more W/U's than 98.992% of seti users. +/- 0.01%
>

David

unread,
Jan 11, 2001, 8:09:21 PM1/11/01
to
tmch...@my-deja.com wrote:
>
> > fdformat /dev/fd0H1440
>
> Thanks. But I have to use superformat. fdformat is obsolete in Debian
> potato. Can't use it.
>

This is part of what makes Linux so damn hard for newbies to understand.
Every distro uses different tools to do the same thing.

Dries van Oosten

unread,
Jan 12, 2001, 3:35:40 AM1/12/01
to
On Thu, 11 Jan 2001 tmch...@my-deja.com wrote:

> > man dd and man cp would give you a pretty good idea.
> > cp copies from file system to filesystem, dd copies from device to >
> > device.
>
> Huh? So does that mean I can dd an ext2 file to an msdos-formatted
> floppy disk and it'll be ok?

That not what I meant. What I mean is, that if you have two devices (let's
say: two harddisk partitions of equal size). If you dd one device to the
other (so the in and output files you give dd are the devices, not the
mount points), dd won't care about filesystems, it will just copy from one
device to the next. This will mean that even the filesystem of the output
partition will be written over by the filesystem of the input partition.

> What if I leave out bs and count? Are there any default values that dd
> uses? What if I want to copy /vmlinuz to a floppy (kernel image is 980
> blocks, 1 block is 1024 bytes) and I added the wrong parameter values
> like, say, bs=512 count=1024, how would it affect the dd? Would I still
> be able to boot?

I never use the dd parameters, the default block size always works for me.
If you give the wrong values, you might not get all the info and you will
most likely not be able to boot.

> Is ls -b the way to find out the block size of a file?

man ls

Groeten,
Dries


0 new messages