public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Using dd command and copy
@ 2012-10-19 12:07 chesschi
       [not found] ` <50815062.50002@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: chesschi @ 2012-10-19 12:07 UTC (permalink / raw)
  To: cygwin

Hi all,

I am trying to write a script to do a "dd" to copy an image from a local
disk to a USB flash drive followed by copying some other files to the flash
drive. 

e.g. if the flash drive is d and mapped to /dev/sdb
    dd if=myfiles.iso of=/dev/sdb
    cd myfolder
    cp -rf */cygdrive/d


After dd and copy finishes, I eject the flash drive and reinsert to the USB
port. I found that some of the files are courrpted!

If I dd first, eject the USB flash drive then do the copying, it is okay.

Is there a way to automate this procedure without manually ejecting the
flash drive? Thank you.



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-dd-command-and-copy-tp93690.html
Sent from the Cygwin list mailing list archive at Nabble.com.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using dd command and copy
       [not found]   ` <CAHHHhBab-_AiwLLGE69UT1yCY6WEP=AY_38vBGN2JcJmFmyHxQ@mail.gmail.com>
@ 2012-10-19 15:38     ` marco atzeri
  2012-10-19 15:56       ` chesschi
  0 siblings, 1 reply; 6+ messages in thread
From: marco atzeri @ 2012-10-19 15:38 UTC (permalink / raw)
  To: cygwin

On 10/19/2012 5:28 PM, wing cheng wrote:
> Unfortunately it is not working.... there are still files corrupted. Any
> idea?
>

use the list please.

> On Fri, Oct 19, 2012 at 2:06 PM, marco atzeri  wrote:
>
>     On 10/19/2012 2:07 PM, chesschi wrote:
>
>         Hi all,
>
>         I am trying to write a script to do a "dd" to copy an image from
>         a local
>         disk to a USB flash drive followed by copying some other files
>         to the flash
>         drive.
>
>         e.g. if the flash drive is d and mapped to /dev/sdb
>               dd if=myfiles.iso of=/dev/sdb
>               cd myfolder
>               cp -rf */cygdrive/d
>
>
>         After dd and copy finishes, I eject the flash drive and reinsert
>         to the USB
>         port. I found that some of the files are courrpted!
>
>         If I dd first, eject the USB flash drive then do the copying, it
>         is okay.
>
>         Is there a way to automate this procedure without manually
>         ejecting the
>         flash drive? Thank you.
>
>
>     have you tested sync instead of ejecting ?
>
>
>


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using dd command and copy
  2012-10-19 15:38     ` marco atzeri
@ 2012-10-19 15:56       ` chesschi
  2012-10-19 16:06         ` marco atzeri
  0 siblings, 1 reply; 6+ messages in thread
From: chesschi @ 2012-10-19 15:56 UTC (permalink / raw)
  To: cygwin

I am new to this forum....

Marco, Thank you for your reply. I am sorry I replied you directly because I
saw you did not post your solution to the forum but the message go
straightly to my email......

By the way... my flash drive is an embedded drive 512MB like a small compact
flash and it needs an adapter to connect to the USB port. The filesystem is
FAT.

Also, I found that after using "dd" to copy the image to the flash drive,
the flash drive is still emtpy (I cannot see anything from the Windows
Explorer). But if I eject the flash drive and connect it back, I can saw the
contents.

Any idea how to solve the problem?



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-dd-command-and-copy-tp93690p93700.html
Sent from the Cygwin list mailing list archive at Nabble.com.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using dd command and copy
  2012-10-19 15:56       ` chesschi
@ 2012-10-19 16:06         ` marco atzeri
  2012-10-19 16:34           ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: marco atzeri @ 2012-10-19 16:06 UTC (permalink / raw)
  To: cygwin

On 10/19/2012 5:56 PM, chesschi wrote:
> I am new to this forum....
>
> Marco, Thank you for your reply. I am sorry I replied you directly because I
> saw you did not post your solution to the forum but the message go
> straightly to my email......

sorry, my fault. (PS: it is mailing list not a forum)


> By the way... my flash drive is an embedded drive 512MB like a small compact
> flash and it needs an adapter to connect to the USB port. The filesystem is
> FAT.
>
> Also, I found that after using "dd" to copy the image to the flash drive,
> the flash drive is still emtpy (I cannot see anything from the Windows
> Explorer). But if I eject the flash drive and connect it back, I can saw the
> contents.
>
> Any idea how to solve the problem?


it seems really that windows need to re-read the filesystem status.

eventually you can try sysinternals sync

http://technet.microsoft.com/en-us/sysinternals/bb897438

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using dd command and copy
  2012-10-19 16:06         ` marco atzeri
@ 2012-10-19 16:34           ` Corinna Vinschen
  2012-10-22 11:31             ` chesschi
  0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2012-10-19 16:34 UTC (permalink / raw)
  To: cygwin

On Oct 19 18:06, marco atzeri wrote:
> On 10/19/2012 5:56 PM, chesschi wrote:
> >I am new to this forum....
> >
> >Marco, Thank you for your reply. I am sorry I replied you directly because I
> >saw you did not post your solution to the forum but the message go
> >straightly to my email......
> 
> sorry, my fault. (PS: it is mailing list not a forum)
> 
> 
> >By the way... my flash drive is an embedded drive 512MB like a small compact
> >flash and it needs an adapter to connect to the USB port. The filesystem is
> >FAT.
> >
> >Also, I found that after using "dd" to copy the image to the flash drive,
> >the flash drive is still emtpy (I cannot see anything from the Windows
> >Explorer). But if I eject the flash drive and connect it back, I can saw the
> >contents.
> >
> >Any idea how to solve the problem?
> 
> 
> it seems really that windows need to re-read the filesystem status.
> 
> eventually you can try sysinternals sync

Shouldn't diskpart do the trick?  The diskpart command is "rescan"


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using dd command and copy
  2012-10-19 16:34           ` Corinna Vinschen
@ 2012-10-22 11:31             ` chesschi
  0 siblings, 0 replies; 6+ messages in thread
From: chesschi @ 2012-10-22 11:31 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen-2 wrote
> Shouldn't diskpart do the trick?  The diskpart command is "rescan"

Thanks Corinna.

I found that "rescan" is not working BUT "remove" followed by "assigned" is
working!
e.g.
select volume d
remove letter d
assign letter=d

One thing I found it is interesting is, when I use "remove", the drive is
still there in the Control Panel Disk Management but no letter is assigned.
If I then use "assign", the drive is assigned with letter and the drive is
no longer empty!

I tried "rescan" or "sync -r/-e" (marco suggested) that both attempt to
flush the filesystem, the drive is still empty after flushing.

Anyway, thanks a lot for your help!



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Using-dd-command-and-copy-tp93690p93870.html
Sent from the Cygwin list mailing list archive at Nabble.com.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-22 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19 12:07 Using dd command and copy chesschi
     [not found] ` <50815062.50002@gmail.com>
     [not found]   ` <CAHHHhBab-_AiwLLGE69UT1yCY6WEP=AY_38vBGN2JcJmFmyHxQ@mail.gmail.com>
2012-10-19 15:38     ` marco atzeri
2012-10-19 15:56       ` chesschi
2012-10-19 16:06         ` marco atzeri
2012-10-19 16:34           ` Corinna Vinschen
2012-10-22 11:31             ` chesschi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).