mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolabs.com>
To: Michael Zhu <mylinuxk@yahoo.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: "dd" collapsed the loop device
Date: Mon, 14 Jan 2002 11:18:43 -0700	[thread overview]
Message-ID: <20020114111843.P26688@lynx.adilger.int> (raw)
In-Reply-To: <20020114175446.24132.qmail@web14913.mail.yahoo.com>
In-Reply-To: <20020114175446.24132.qmail@web14913.mail.yahoo.com>; from mylinuxk@yahoo.ca on Mon, Jan 14, 2002 at 12:54:46PM -0500

On Jan 14, 2002  12:54 -0500, Michael Zhu wrote:
> Hello,everyone,I have a problem when I used the loop
> device. I don't know whether is a loop device bug.

User bug.

> I used the following commands to connect the loop device
> with the floppy disk device.
> 
> losetup -e xor /dev/loop0 /dev/fd0
> mke2fs /dev/loop0
> mount /dev/loop0 /floppy
> 
> Then I copy something to the floppy and read it back.
> Everything is OK. It works perfectly. 

Great.

> The problem was happened when I try to copy something
> directly from the /dev/fd0. I use the following
> demand.
> 
> dd if=test.c of=/dev/fd0
> 
> The output of the upper command is:
> 50+1 records in
> 50+1 records out
> 
> Then I used the "ls /floppy". I found nothing copied
> to the floppy.

Well, this is wrong for several reasons:
1) don't access /dev/fd0 when you use it via loopback, use /dev/loop0
2) don't use "dd" to copy a file, use "cp"
3) don't write into the device, but the filesystem instead:
   cp test.c /floppy

> Then I used "umount /floppy" to umount the floppy disk
> device. After that I used the following command to try
> to mount the floppy disk again.
>
> mount /dev/loop0 /floppy
> 
> It returned an error. Say:
> 
> mount: wrong fs type. bad option. bad superblock on
> /dev/loop0. or too many mounted file systems
> 
> It seemed that the "dd if=test.c of=/dev/fd0"
> corrupted the data on the floppy disk. What is wrong?

Because test.c is not a filesystem, and you have overwritten
the filesystem on /dev/fd0 with junk.  This is not a bug
in the loop driver.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


  reply	other threads:[~2002-01-14 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-14 17:54 Michael Zhu
2002-01-14 18:18 ` Andreas Dilger [this message]
2002-01-14 18:40   ` Michael Zhu
2002-01-14 20:06     ` Andreas Dilger
2002-01-14 18:09 Jesse Pollard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020114111843.P26688@lynx.adilger.int \
    --to=adilger@turbolabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mylinuxk@yahoo.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®