Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Trying to write OS to SD card

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
Gordon
Posts: 4
Joined: 2017-01-29 22:27

Trying to write OS to SD card

#1 Post by Gordon »

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

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1418
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 80 times
Been thanked: 191 times

Re: Trying to write OS to SD card

#2 Post by steve_v »

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.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

User avatar
sunrat
Administrator
Administrator
Posts: 6495
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 476 times

Re: Trying to write OS to SD card

#3 Post by sunrat »

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!

srq2625
Posts: 44
Joined: 2016-02-26 11:01

Re: Trying to write OS to SD card

#4 Post by srq2625 »

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.

Gordon
Posts: 4
Joined: 2017-01-29 22:27

Re: Trying to write OS to SD card

#5 Post by Gordon »

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.

Post Reply