LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 10-23-2016, 02:25 PM   #1
sryzdn
Member
 
Registered: Feb 2013
Posts: 273

Rep: Reputation: 9
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.
 
Old 10-23-2016, 02:29 PM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,316

Rep: Reputation: Disabled
Your command is backwards, the input is sdd and the output is a regular file.
 
Old 10-23-2016, 02:30 PM   #3
sryzdn
Member
 
Registered: Feb 2013
Posts: 273

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by Emerson View Post
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.
 
Old 10-23-2016, 02:38 PM   #4
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,316

Rep: Reputation: Disabled
Those steps are optional, your card is ready after initial dd command.
 
Old 10-23-2016, 02:41 PM   #5
sryzdn
Member
 
Registered: Feb 2013
Posts: 273

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by Emerson View Post
Those steps are optional, your card is ready after initial dd command.
what would be the address for "from-SD-card" anyway?
 
Old 10-23-2016, 02:43 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,843

Rep: Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472
Quote:
Originally Posted by Emerson View Post
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.
 
Old 10-23-2016, 03:53 PM   #7
73Ham
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Rep: Reputation: Disabled
@OP : You can have a progress indicator by adding status=progress to the dd command.

73
 
Old 10-24-2016, 08:48 AM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,438
Blog Entries: 31

Rep: Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607
Member response

Hi,

Quote:
Originally Posted by sryzdn View Post
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!
 
Old 10-24-2016, 08:53 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,438
Blog Entries: 31

Rep: Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607Reputation: 2607
Member response

Hi,

Quote:
Originally Posted by sryzdn View Post
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How could a computer technician use the "top" command with "ps" and "kill" to investigate how a system is misbehaving? geckono1 Linux - Newbie 13 07-03-2016 07:51 AM
[SOLVED] How can I mount a HDD image that created by "dd" command? hack3rcon Linux - Software 2 02-16-2015 10:39 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
(1) Realtek card is called "tulip", (2) dynamic IP makes eth0 down Erhan Linux - Networking 3 12-31-2003 02:54 AM
Doing "make" command makes system freeze weiss Linux - Newbie 16 10-09-2003 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration