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.
|
 |
10-23-2016, 02:25 PM
|
#1
|
Member
Registered: Feb 2013
Posts: 274
Rep:
|
how "dd" command makes an image in an SD card (for raspberry)?
Hi,
I want to install raspbian image on my SD Card in Linux. So I am following this tutorial.
There is a command there:
Quote:
dd bs=4M if=/dev/sdd of=from-sd-card.img
|
How can I find the address I should put for `from-sd-card.img`?
Any help is appreciated.
|
|
|
10-23-2016, 02:29 PM
|
#2
|
LQ Sage
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675
Rep: 
|
Your command is backwards, the input is sdd and the output is a regular file.
|
|
|
10-23-2016, 02:30 PM
|
#3
|
Member
Registered: Feb 2013
Posts: 274
Original Poster
Rep:
|
Quote:
Originally Posted by Emerson
Your command is backwards, the input is sdd and the output is a regular file.
|
Please take a look at the link I put in my question. That is after dd the image in the SD card.
|
|
|
10-23-2016, 02:38 PM
|
#4
|
LQ Sage
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675
Rep: 
|
Those steps are optional, your card is ready after initial dd command.
|
|
|
10-23-2016, 02:41 PM
|
#5
|
Member
Registered: Feb 2013
Posts: 274
Original Poster
Rep:
|
Quote:
Originally Posted by Emerson
Those steps are optional, your card is ready after initial dd command.
|
what would be the address for "from-SD-card" anyway?
|
|
|
10-23-2016, 02:43 PM
|
#6
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Quote:
Originally Posted by Emerson
Your command is backwards, the input is sdd and the output is a regular file.
|
No, this is making a copy of the sdcard, so the direction is correct.
The "from-sd-card.img" is a file on your system. It is a block for block copy, even unused blocks. This is why the tutorial is assuming the SDcard has not yet been used (which has the option to expand the filesystem to use the entire sdcard). IF the sdcard has been expanded, do NOT truncate. And do NOT compare to the original image - they WILL NOT MATCH.
You can keep the file though. All it serves is a backup.
For the purpose of the tutorial what is being done is:
1. copy the original image to the SDcard
2. copy the SDcard to a new file.
3. IF the new file is larger than the original image, you have to truncate it to the size of the original image.
4. compare the new file(possibly truncated) against the original image.
The last step is just to verify that the data you wrote to the SDcard in step 1 matches what is on the image file. Nothing else.
Last edited by jpollard; 10-23-2016 at 02:45 PM.
Reason: oops.
|
|
|
10-23-2016, 03:53 PM
|
#7
|
LQ Newbie
Registered: Oct 2016
Posts: 2
Rep: 
|
@OP : You can have a progress indicator by adding status=progress to the dd command.
73
|
|
|
10-24-2016, 08:48 AM
|
#8
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,996
|
Member response
Hi,
Quote:
Originally Posted by sryzdn
Hi,
I want to install raspbian image on my SD Card in Linux. So I am following this tutorial.
There is a command there:
How can I find the address I should put for `from-sd-card.img`?
Any help is appreciated.
|
You have things transposed;
Quote:
From your link https://www.raspberrypi.org/document...mages/linux.md
- In the terminal, write the image to the card with the command below, making sure you replace the input file if= argument with the path to your .img file, and the /dev/sdd in the output file of= argument with the right device name. This is very important, as you will lose all data on the hard drive if you provide the wrong device name. Make sure the device name is the name of the whole SD card as described above, not just a partition of it; for example, sdd, not sdds1 or sddp1, and mmcblk0, not mmcblk0p1.
dd bs=4M if=2016-09-23-raspbian-jessie.img of=/dev/sdd
|
Please look at the options for 'dd' below.
From 'man dd';
Quote:
dd - convert and copy a file
SYNOPSIS
dd [OPERAND]...
dd OPTION
DESCRIPTION
Copy a file, converting and formatting according to the operands.
bs=BYTES
read and write up to BYTES bytes at a time
cbs=BYTES
convert BYTES bytes at a time
conv=CONVS
convert the file as per the comma separated symbol list
count=N
copy only N input blocks
ibs=BYTES
read up to BYTES bytes at a time (default: 512)
if=FILE
read from FILE instead of stdin
iflag=FLAGS
read as per the comma separated symbol list
obs=BYTES
write BYTES bytes at a time (default: 512)
of=FILE
write to FILE instead of stdout
oflag=FLAGS
write as per the comma separated symbol list
seek=N skip N obs-sized blocks at start of output
skip=N skip N ibs-sized blocks at start of input
status=WHICH
WHICH info to suppress outputting to stderr; 'noxfer' suppresses transfer stats, 'none' suppresses all
|
When in doubt then please look at the 'man command' to help you understand the command operations.
Hope this helps.
Have fun & enjoy!

|
|
|
10-24-2016, 08:53 AM
|
#9
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,996
|
Member response
Hi,
Quote:
Originally Posted by sryzdn
Please take a look at the link I put in my question. That is after dd the image in the SD card.
|
That is for checking & verifying the copied image to the SD card;
Quote:
From https://www.raspberrypi.org/document...mages/linux.md
- You can check what's written to the SD card by dd-ing from the card back to another image on your hard disk, truncating the new image to the same size as the original, and then running diff (or md5sum) on those two images.
- The SD card might be bigger than the original image, and dd will make a copy of the whole card. We must therefore truncate the new image to the size of the original image. Make sure you replace the input file if= argument with the right device name. diff should report that the files are identical.
dd bs=4M if=/dev/sdd of=from-sd-card.img truncate --reference 2016-09-23-raspbian-jessie.img from-sd-card.img diff -s from-sd-card.img 2016-09-23-raspbian-jessie.img
|
Hope this helps.
Have fun & enjoy!

|
|
|
All times are GMT -5. The time now is 07:35 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
|
|