Trying to write OS to SD card

Help with issues regarding installation of Debian

Trying to write OS to SD card

Postby Gordon » 2017-04-05 03:45

Hello everyone,

I'm trying to write an OS image to a SD card. I'm following this guide: https://www.youtube.com/watch?v=ana7uz0l728

I ran the following command: sudo dd bs=1M if=XBian_2017.03.31_rpi3.img

I should have run the following command instead: sudo dd bs=1M if=XBian_2017.03.31_rpi3.im of=/dev/sdb

I do believe I may have written the image to sda instead of sdb. I panicked and turned off the computer :lol: . When I booted it looked like the operation completed (I feel really stupid). Feel free to make fun of me :oops:

This is what it shows when I run sudo fdisk -l:

Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 976895 974848 476M 83 Linux
/dev/sdc2 978942 976771071 975792130 465.3G 5 Extended
/dev/sdc5 978944 352538623 351559680 167.7G 83 Linux
/dev/sdc6 352540672 938475519 585934848 279.4G 83 Linux
/dev/sdc7 938477568 976771071 38293504 18.3G 83 Linux

I know it should be showing /dev/sda instead of /dev/sdc. Can my screw up be fixed?

Thanks for the help
Gordon
 
Posts: 4
Joined: 2017-01-29 22:27

Re: Trying to write OS to SD card

Postby steve_v » 2017-04-05 04:35

Gordon wrote:I ran the following command: sudo dd bs=1M if=XBian_2017.03.31_rpi3.img
dd without an output file (of=) doesn't write anything.

Gordon wrote:I know it should be showing /dev/sda instead of /dev/sdc.
/dev/sd[x] disk nodes are not bound to a specific device, and which disk gets which label depends on detection order.
Use /dev/disk/by-id or /dev/disk/by-uuid if you want to be certain what's what.

Gordon wrote:Can my screw up be fixed?
What's actually "screwed up"? if it's just that sda became sdc, and the system is otherwise working ok, don't worry about it.
If you can mount (or boot from) the device then it's fine.
If you did accidentally write to the wrong device the filesystem there will be trashed. Restore from backup.
steve_v
 
Posts: 460
Joined: 2012-10-06 05:31
Location: New Zealand

Re: Trying to write OS to SD card

Postby sunrat » 2017-04-05 22:27

dd is not called disk destroyer for nothing. It will do what you tell it to, so be sure you are telling it the correct command. I always check to see what the system sees a removable disk as before proceeding. Immediately after inserting the device, check with
Code: Select all
dmesg |tail
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 1993
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Trying to write OS to SD card

Postby srq2625 » 2017-04-06 11:04

sunrat wrote:Immediately after inserting the device, check with
Code: Select all
dmesg |tail

Another way I like to use is to insert your device and run
Code: Select all
lsblk
This works well if you know the sizes of the devices attached to your computer.
srq2625
 
Posts: 38
Joined: 2016-02-26 11:01

Re: Trying to write OS to SD card

Postby Gordon » 2017-04-07 01:05

Thanks for all the help. It looks like I didn't do any damage :D I will be more careful next time. My disk is also showing /dev/sda again.
Gordon
 
Posts: 4
Joined: 2017-01-29 22:27


Return to Installation

Who is online

Users browsing this forum: victorrms and 7 guests

fashionable