Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-27-2017, 05:11 PM
|
#1
|
LQ Newbie
Registered: Apr 2017
Posts: 4
Rep:
|
dd command and unexpected results
This is puzzle ...at least to me.
I dd a rasbian image to a new sd card like so:
sudo dd bs=4M if=2017-04-10-raspbian-jessie.img of=/dev/sdc
First time the image is no good (gets the root partition, but no boot partition, or what's supposed to be the boot partition is full of files with garbled names).
But if I re-do the same command, it works the second time.
Regards,
Mac
|
|
|
04-27-2017, 05:15 PM
|
#2
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,284
Rep:
|
Hi and welcome to LQ.
After dd, you should issue the command: to flush the write buffer. Did you do it?
|
|
|
04-27-2017, 05:17 PM
|
#3
|
LQ Newbie
Registered: Apr 2017
Posts: 4
Original Poster
Rep:
|
yes, I use sync every time.
|
|
|
04-27-2017, 05:22 PM
|
#4
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,284
Rep:
|
Then, maybe there is an issue with the SD card itself?
|
|
|
04-27-2017, 05:36 PM
|
#5
|
LQ Newbie
Registered: Apr 2017
Posts: 4
Original Poster
Rep:
|
Happened with multiple cards. Latest just yesterday with new card, fresh out of packaging.
Has happened on different writers and different hardware.
I'm wondering if automount is somehow trying to mount before it's done. But, then why does it work the second time...
Or maybe whatever the existing partitioning is messes it up first time around, but since after the first go the partition is screwy and the second time it works.
|
|
|
04-27-2017, 05:39 PM
|
#6
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,284
Rep:
|
In any case I would disable automount before using dd.
|
|
|
04-27-2017, 05:43 PM
|
#7
|
LQ Newbie
Registered: Apr 2017
Posts: 4
Original Poster
Rep:
|
Yeah, it's on by default in Ubuntu and I've been too lazy to figure out how to temporarily disable it...
|
|
|
04-27-2017, 07:08 PM
|
#8
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,314
|
Looks like a race - the second execution will read the image from page cache. Use "oflag=sync" on the dd command rather than sync afterwards - slows it down (probably what you want in this case), but always works for me.
|
|
|
04-27-2017, 08:13 PM
|
#9
|
Member
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508
Rep:
|
I've had dd do some weird things before too, but it usually works fine.
|
|
|
04-27-2017, 08:42 PM
|
#10
|
Moderator
Registered: Mar 2008
Posts: 22,233
|
Just for grins.
sudo dd if=2017-04-10-raspbian-jessie.img of=/dev/sdc, sync
|
|
|
04-27-2017, 10:20 PM
|
#11
|
LQ Guru
Registered: Dec 2011
Distribution: Slackware, Debian 12, Devuan & MX Linux
Posts: 9,528
|
Quote:
Originally Posted by jefro
Just for grins.
sudo dd if=2017-04-10-raspbian-jessie.img of=/dev/sdc, sync
|
Grins are generally accompanied by giggles:-
|
|
|
04-27-2017, 10:31 PM
|
#12
|
Member
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508
Rep:
|
I didn't even know people still had to use sync manually. I don't think I've used it since ancient versions of SunOS (the BSD version, not Solaris SVR4 versions). I thought those problems were fixed.
|
|
|
04-28-2017, 12:56 AM
|
#13
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,284
Rep:
|
Quote:
Originally Posted by jefro
Just for grins.
sudo dd if=2017-04-10-raspbian-jessie.img of=/dev/sdc, sync
|
A semicolon instead of a comma should separate the commands, see POSIX
|
|
|
All times are GMT -5. The time now is 02:41 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|