FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 01-07-2011, 11:58 AM
Colin Law
 
Default A question about burning USB stick

Hi
I have an image that I wish to burn to a USB stick using dd. When I
insert the stick it is mounted (it already has valid partitions on it)
and
sudo fdisk -l
shows that it is mounted as sdb. The command I am going to use to burn it is
sudo dd if=myfile.bin of=/dev/sdb bs=10M
but it does not seem right to burn it while it is mounted. However if
I eject it then it is no longer /dev/sdb and the dd command fails.

So the first question is, is it correct just to go ahead and run dd
with the stick mounted?

Once the burn is complete then there is a similar question, should I
'eject' it before unplugging it? The reason I ask is that I am
concerned that the system may be confused about whether it is
unmounting and ejecting the original image or the one I have
re-written.

The reason I am asking the questions in the first place is that I have
some problems and am not sure whether it is what I am doing that is
wrong or if the stick is faulty.
The symptom is that when I burn it then success is reported and it
says it has written 4022337024 bytes (which is the size of the image
file). If I immediately (without ejecting) dump it back again using
sudo dd if=/dev/sdb of=dumpfile.bin bs=10M
it again reports success with the same number of bytes transferred.
However if I diff the original file and the dumped one the contents
are different (they are the same size).

If I 'eject' the stick and re-insert it and then dump it again using
dd then I get an I/O error at about 3.6GB of the 4GB stick.

I have two sticks doing basically the same thing (both SanDisk Cruzer
Blade) though both have had some use. I trying to determine whether I
am doing something wrong or whether I need to get a new stick.

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-07-2011, 02:25 PM
Nils Kassube
 
Default A question about burning USB stick

Colin Law wrote:
> I have an image that I wish to burn to a USB stick using dd. When I
> insert the stick it is mounted (it already has valid partitions on
> it) and
> sudo fdisk -l
> shows that it is mounted as sdb.

I think you mean that the command shows it is the device /dev/sdb - the
fdisk command doesn't show what is mounted.

> The command I am going to use to
> burn it is sudo dd if=myfile.bin of=/dev/sdb bs=10M
> but it does not seem right to burn it while it is mounted. However
> if I eject it then it is no longer /dev/sdb and the dd command
> fails.

If you eject a USB device, it is disabled, which is the same as if you
unplug it. After that operation you have to unplug it because it is no
longer accessible.

> So the first question is, is it correct just to go ahead and run dd
> with the stick mounted?

It depends if it is really mounted. It is unlikely that /dev/sdb is
mounted if there are valid partitions on it. The partition(s) can be
mounted though and if that is the case you should unmount them (don't
use eject). That would be a command like

sudo umount /dev/sdb?

> Once the burn is complete then there is a similar question, should I
> 'eject' it before unplugging it? The reason I ask is that I am
> concerned that the system may be confused about whether it is
> unmounting and ejecting the original image or the one I have
> re-written.

If you used the umount command above, there is nothing for the system to
be confused. OTOH, I'm not so sure if the eject command would work if
the partition table has changed due to the new image. Until now I have
never used eject after writing a disk image but I have always used the
command

sync

after the write command to make sure that all data are written to the
device.

> The reason I am asking the questions in the first place is that I
> have some problems and am not sure whether it is what I am doing
> that is wrong or if the stick is faulty.
> The symptom is that when I burn it then success is reported and it
> says it has written 4022337024 bytes (which is the size of the image
> file). If I immediately (without ejecting) dump it back again using
> sudo dd if=/dev/sdb of=dumpfile.bin bs=10M
> it again reports success with the same number of bytes transferred.
> However if I diff the original file and the dumped one the contents
> are different (they are the same size).
>
> If I 'eject' the stick and re-insert it and then dump it again using
> dd then I get an I/O error at about 3.6GB of the 4GB stick.

Could that be the difference between GB and GiB? At 4GB the difference
would be about 7%, so it might fit depending on what "at about 3.6GB"
means.


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-07-2011, 02:41 PM
"Johnny Rosenberg"
 
Default A question about burning USB stick

Den 2011-01-07 16:25:29 skrev Nils Kassube <kassube@gmx.net>:


Colin Law wrote:

I have an image that I wish to burn to a USB stick using dd. When I
insert the stick it is mounted (it already has valid partitions on
it) and
sudo fdisk -l
shows that it is mounted as sdb.


I think you mean that the command shows it is the device /dev/sdb - the
fdisk command doesn't show what is mounted.


The command I am going to use to
burn it is sudo dd if=myfile.bin of=/dev/sdb bs=10M
but it does not seem right to burn it while it is mounted. However
if I eject it then it is no longer /dev/sdb and the dd command
fails.


If you eject a USB device, it is disabled, which is the same as if you
unplug it. After that operation you have to unplug it because it is no
longer accessible.


So the first question is, is it correct just to go ahead and run dd
with the stick mounted?


It depends if it is really mounted. It is unlikely that /dev/sdb is
mounted if there are valid partitions on it. The partition(s) can be
mounted though and if that is the case you should unmount them (don't
use eject). That would be a command like

sudo umount /dev/sdb?


Once the burn is complete then there is a similar question, should I
'eject' it before unplugging it? The reason I ask is that I am
concerned that the system may be confused about whether it is
unmounting and ejecting the original image or the one I have
re-written.


If you used the umount command above, there is nothing for the system to
be confused. OTOH, I'm not so sure if the eject command would work if
the partition table has changed due to the new image. Until now I have
never used eject after writing a disk image but I have always used the
command

sync

after the write command to make sure that all data are written to the
device.


The reason I am asking the questions in the first place is that I
have some problems and am not sure whether it is what I am doing
that is wrong or if the stick is faulty.
The symptom is that when I burn it then success is reported and it
says it has written 4022337024 bytes (which is the size of the image
file). If I immediately (without ejecting) dump it back again using
sudo dd if=/dev/sdb of=dumpfile.bin bs=10M
it again reports success with the same number of bytes transferred.
However if I diff the original file and the dumped one the contents
are different (they are the same size).

If I 'eject' the stick and re-insert it and then dump it again using
dd then I get an I/O error at about 3.6GB of the 4GB stick.


Could that be the difference between GB and GiB? At 4GB the difference
would be about 7%, so it might fit depending on what "at about 3.6GB"
means.


Probably not hte whole truth, since 4.000 GB≈3.725 GiB.


--
Kind regards

Johnny Rosenberg

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-07-2011, 04:29 PM
Colin Law
 
Default A question about burning USB stick

On 7 January 2011 15:25, Nils Kassube <kassube@gmx.net> wrote:
> Colin Law wrote:
>> I have an image that I wish to burn to a USB stick using dd. *When I
>> insert the stick it is mounted (it already has valid partitions on
>> it) and
>> sudo fdisk -l
>> shows that it is mounted as sdb.
>
> I think you mean that the command shows it is the device /dev/sdb - the
> fdisk command doesn't show what is mounted.

Quite right, of course, sloppy thinking on my part.

>
>> The command I am going to use to
>> burn it is sudo dd if=myfile.bin of=/dev/sdb bs=10M
>> but it does not seem right to burn it while it is mounted. *However
>> if I eject it then it is no longer /dev/sdb and the dd command
>> fails.
>
> If you eject a USB device, it is disabled, which is the same as if you
> unplug it. After that operation you have to unplug it because it is no
> longer accessible.
>
>> So the first question is, is it correct just to go ahead and run dd
>> with the stick mounted?
>
> It depends if it is really mounted. It is unlikely that /dev/sdb is
> mounted if there are valid partitions on it. The partition(s) can be
> mounted though and if that is the case you should unmount them (don't
> use eject). That would be a command like
>
> sudo umount /dev/sdb?

Great, that is what I was looking for, that lets me unmount it without
disabling it.

>
>> Once the burn is complete then there is a similar question, should I
>> 'eject' it before unplugging it? *The reason I ask is that I am
>> concerned that the system may be confused about whether it is
>> unmounting and ejecting the original image or the one I have
>> re-written.
>
> If you used the umount command above, there is nothing for the system to
> be confused. OTOH, I'm not so sure if the eject command would work if
> the partition table has changed due to the new image. Until now I have
> never used eject after writing a disk image but I have always used the
> command
>
> sync
>
> after the write command to make sure that all data are written to the
> device.

Once again, just what I was looking for. Thanks.

>
>> The reason I am asking the questions in the first place is that I
>> have some problems and am not sure whether it is what I am doing
>> that is wrong or if the stick is faulty.
>> The symptom is that when I burn it then success is reported and it
>> says it has written 4022337024 bytes (which is the size of the image
>> file). *If I immediately (without ejecting) dump it back again using
>> sudo dd if=/dev/sdb of=dumpfile.bin bs=10M
>> it again reports success with the same number of bytes transferred.
>> However if I diff the original file and the dumped one the contents
>> are different (they are the same size).
>>
>> If I 'eject' the stick and re-insert it and then dump it again using
>> dd then I get an I/O error at about 3.6GB of the 4GB stick.
>
> Could that be the difference between GB and GiB? At 4GB the difference
> would be about 7%, so it might fit depending on what "at about 3.6GB"
> means.

No, it is not that, the number of bytes written is reduced also, and
it is not always 3.6GB. The fact that I also get an I/O error seemed
to point to a problem of some sort also.

Armed with my new found knowledge, thanks to yourself, I tried again,
unmounting before burning, and syncing after burning. Unfortunately
when I then try to dump from the stick I again get an IO error, but
this time it is even earlier, at 3.1GB. So I suspect it is time to
send the stick to the bin. I have ordered a new one.

Many thanks for the help.

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 12:07 AM
Basil Chupin
 
Default A question about burning USB stick

On 07/01/2011 23:58, Colin Law wrote:

Hi
I have an image that I wish to burn to a USB stick using dd. When I
insert the stick it is mounted (it already has valid partitions on it)
and
sudo fdisk -l
shows that it is mounted as sdb. The command I am going to use to burn it is
sudo dd if=myfile.bin of=/dev/sdb bs=10M
but it does not seem right to burn it while it is mounted. However if
I eject it then it is no longer /dev/sdb and the dd command fails.


Colin,

I do not understand what you really mean by doing a "burn to a USB
stick". One burns a DVD or a CD but not a flash drive.


All you are trying to do is to copy a file to the flash drive, right?
And because the flash drive is more than likely formatted in FAT32 you
can only copy over a file no larger than 4GB.


If this is what you are trying to do - to copy over a file - then simply
plug in the flash drive and use something like mc (midnight commander,
which is what I always use) or nautilus (ie, the file manager) to copy
the file from sourceX to the flash drive. Simple, I do it almost
everyday when doing backups of files on my and my wife's computers or
transferring files from one computer to the other. No"dds" or anything -
just a simply straightforward copy. You could probably use the standard
"cp" command to do same.


Only thing to watch is that after the copy has been done, SAFELY REMOVE
the flash so that all the data has, in fact. been written to the flash.
As you select 'safely remove', watch the light on the flash: if there is
unwritten data this light will keep flashing as the data is being
written and when this stops then remove the flash.


BC

--
"Opinions are like assholes - everyone has one."
Inspector "Dirty Harry" Callahan


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 12:53 AM
MR ZenWiz
 
Default A question about burning USB stick

On Fri, Jan 7, 2011 at 5:07 PM, Basil Chupin <blchupin@iinet.net.au> wrote:
>
:
>
> Only thing to watch is that after the copy has been done, SAFELY REMOVE the
> flash so that all the data has, in fact. been written to the flash. As you
> select 'safely remove', watch the light on the flash: if there is unwritten
> data this light will keep flashing as the data is being written and when
> this stops then remove the flash.
>
Or run sync before removing the drive (via umount, eject or "safely remove").

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 03:53 AM
Basil Chupin
 
Default A question about burning USB stick

On 08/01/2011 12:53, MR ZenWiz wrote:

On Fri, Jan 7, 2011 at 5:07 PM, Basil Chupin<blchupin@iinet.net.au> wrote:
:

Only thing to watch is that after the copy has been done, SAFELY REMOVE the
flash so that all the data has, in fact. been written to the flash. As you
select 'safely remove', watch the light on the flash: if there is unwritten
data this light will keep flashing as the data is being written and when
this stops then remove the flash.


Or run sync before removing the drive (via umount, eject or "safely remove").


No doubt, but why go thru this when it is available on the
workspace/desktop by clicking on the icon for the device (or going to
Places) and selecting Safely Remove?


But then, some people prefer to scratch their left ear by using their
right hand....... :-) .


BC

--
"Opinions are like assholes - everyone has one."
Inspector "Dirty Harry" Callahan


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 07:40 AM
Colin Law
 
Default A question about burning USB stick

On 8 January 2011 01:07, Basil Chupin <blchupin@iinet.net.au> wrote:
> On 07/01/2011 23:58, Colin Law wrote:
>>
>> Hi
>> I have an image that I wish to burn to a USB stick using dd. *When I
>> insert the stick it is mounted (it already has valid partitions on it)
>> and
>> sudo fdisk -l
>> shows that it is mounted as sdb. *The command I am going to use to burn it
>> is
>> sudo dd if=myfile.bin of=/dev/sdb bs=10M
>> but it does not seem right to burn it while it is mounted. *However if
>> I eject it then it is no longer /dev/sdb and the dd command fails.
>
> Colin,
>
> I do not understand what you really mean by doing a "burn to a USB stick".
> One burns a DVD or a CD but not a flash drive.

I have an image of the complete stick in myfile.bin that I wish to
dump onto the stick using dd. It is the equivalent of burning an iso
image onto CD which is why I used the word burn. The image contains a
bootable Ubuntu image. Having installed Ubuntu on the stick and
installed and configured all the applications I want to use I use dd
to make a backup of the stick so that if it fails (as this one has) I
can restore the image to a new stick without having to go through the
effort of making a new image.

>
> All you are trying to do is to copy a file to the flash drive, right? And
> because the flash drive is more than likely formatted in FAT32 you can only
> copy over a file no larger than 4GB.

No, it is a complete image of the stick.

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 08:38 AM
Nils Kassube
 
Default A question about burning USB stick

Colin Law wrote:
> On 8 January 2011 01:07, Basil Chupin <blchupin@iinet.net.au> wrote:
> > On 07/01/2011 23:58, Colin Law wrote:
> >> I have an image that I wish to burn to a USB stick using dd.
> >> The command I am going to use to
> >> burn it is
> >> sudo dd if=myfile.bin of=/dev/sdb bs=10M

> > I do not understand what you really mean by doing a "burn to a USB
> > stick". One burns a DVD or a CD but not a flash drive.

Basil, you don't really "burn" a CD / DVD either or do you set it on
fire? (SCNR)

I think from the context you quoted (the dd command) it is clear what
Colin intended to do.

> I have an image of the complete stick in myfile.bin that I wish to
> dump onto the stick using dd. It is the equivalent of burning an
> iso image onto CD which is why I used the word burn. The image
> contains a bootable Ubuntu image. Having installed Ubuntu on the
> stick and installed and configured all the applications I want to
> use I use dd to make a backup of the stick so that if it fails (as
> this one has) I can restore the image to a new stick without having
> to go through the effort of making a new image.

Just a side note: I have two 4GB CF cards of the same model which have a
slightly different number of tracks announced to the kernel. I only
noticed this fact when I wanted to make a clone of one card (the one
with more tracks) to the other one. Therefore I now make the last
partition slightly smaller than possible. Then there are no data lost on
the last tracks if I ever have to restore a backup to a new card.


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-08-2011, 08:58 AM
Thierry de Coulon
 
Default A question about burning USB stick

On Saturday 08 January 2011 09:40:36 am Colin Law wrote:
(...)
> >> sudo dd if=myfile.bin of=/dev/sdb bs=10M
> >> but it does not seem right to burn it while it is mounted. *However if
> >> I eject it then it is no longer /dev/sdb and the dd command fails.
(...)
> I have an image of the complete stick in myfile.bin that I wish to
> dump onto the stick using dd.

I think your problem is with "eject", because it "shuts off" the stick (I had
this problem with a card reader in my laptop).

What I think you shoud do is:

- plug in the stick
- check how it is mounted (I guess it should automount as /dev/sdb1 from what
you wrote)
- umount /dev/sdb1 (at the command line!)

Now you stick should still be there (you can test by mounting /dev/sdb1 on
some mountpoint).Now dd should work on /dev/sdb.

Note that you probably nead either sudo or su for most of these commands to
work. I just tried this procedure on my computer and it works.

Regards,

Thierry


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 04:21 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org