LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 05-13-2008, 07:14 PM   #1
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Rep: Reputation: Disabled
dd if=/dev/zero of=/dev/sda bs=512 count=1...oh noes!!!


So i entered this into the terminal wanting to work on my usb (sdb) and it ran as soon as I copy and pasted it. I didn't even get a chance to edit it. So I couldn't boot hardy heron after restart and had to reinstall to feisty. (by the the way, the 7.04 cd is the only cd my drive will boot from- any suggestions?) Now, I can't upgrade back to hardy heron. Does anyone have any ideas on this?
 
Old 05-13-2008, 07:27 PM   #2
armanox
Member
 
Registered: Sep 2005
Location: Baltimore, MD, USA
Distribution: Fedora, Gentoo, Debian, Slackware, IRIX, OS X
Posts: 192

Rep: Reputation: 32
Well....let me explain what you just did.....

dd if=/dev/zero of=/dev/sda

dd -> writes stuffs (like, bit for bit, cylinder for cylinder, etc)

dd if=/dev/zero

write using input file /dev/zero (all zeros)

of=/dev/sda

output and overwrite /dev/sda (first ATA/SCSI/SATA/SAS drive on system (meaning, your hard drvie).

so, the command wiped out everything on your hard drive.
 
Old 05-13-2008, 07:49 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
No, he did NOT erase the whole drive....look again--especially this part: bs=512 count=1 This means do the command for 1 block of 512 bytes. This only erased the MBR.

If you have a live CD, you can boot from that and re-install GRUB from there.
Quote:
and it ran as soon as I copy and pasted it
I'll bet you a cookie that what happened was that the cut and paste included a newline character. That's the signal to bash to run what has just been entered.
 
Old 05-13-2008, 07:53 PM   #4
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Original Poster
Rep: Reputation: Disabled
I do understand what I did . I tried to erase the mbr on my usb. When I copied and pasted it the command to the terminal, terminal ran it automatically. After restarting, Kubuntu would not go past the initial loading screen so I had to downgrade as stated above. Now I cannot upgrade to 8.04 from feisty as stated above.
Does anyone know why this has happened? Can it be that the some part of the old mbr still exist and is conflicting with my upgrading back to 8.04?(My cd drive will only boot from the 7.04 cd) Is there some way to bypass this issue?
 
Old 05-13-2008, 07:57 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
Quote:
Originally Posted by pixellany View Post
I'll bet you a cookie that what happened was that the cut and paste included a newline character. That's the signal to bash to run what has just been entered.
I'm sure you're right - I've had the same thing happen to me. What I do now when I copy/paste commands is to firstly type zq then past the command. In this case, even if the newline is there it will fail because zqdd isn't a recognised command.

It's overkill for some people but once you've had it happen and not been able to easily recover, it's worth the 2 keystrokes. You could also type a "#" and have the line treated as a comment...
 
Old 05-13-2008, 07:58 PM   #6
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pixellany View Post
No, he did NOT erase the whole drive....look again--especially this part: bs=512 count=1 This means do the command for 1 block of 512 bytes. This only erased the MBR.

If you have a live CD, you can boot from that and re-install GRUB from there.
I'll bet you a cookie that what happened was that the cut and paste included a newline character. That's the signal to bash to run what has just been entered.
Thanks pixellany.
Now that I've already downgraded to a fresh install of 7.04 - is there someway to get my comp to upgrade to 8.04 again? Perhaps by creating a grub entry for it or by creating a new mbr??? How would i edit the grub entry from the cd if it was still possible?
 
Old 05-13-2008, 08:01 PM   #7
armanox
Member
 
Registered: Sep 2005
Location: Baltimore, MD, USA
Distribution: Fedora, Gentoo, Debian, Slackware, IRIX, OS X
Posts: 192

Rep: Reputation: 32
Ok, I missed the bs=512 count=1 part...srry....


to upgrade back to 8.04...

change all the entries that say "fiesty" in /etc/apt/sources.list to say "hardy"

then run...

Code:
sudo apt-get update
sudo apt-get dist-upgrade
and that should do the trick.
 
Old 05-13-2008, 08:07 PM   #8
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by armanox View Post
Ok, I missed the bs=512 count=1 part...srry....


to upgrade back to 8.04...

change all the entries that say "fiesty" in /etc/apt/sources.list to say "hardy"

then run...

Code:
sudo apt-get update
sudo apt-get dist-upgrade
and that should do the trick.
I'll try that as soon as i have the time. Thanks for the help.

If anyone else has any suggestions they are more than welcome.
 
Old 05-13-2008, 08:17 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
In situations like this I often just do a fresh install. It might take longer, but I have to think less.

If you can boot from ANY Linux--live CD or otherwise--you can re-install GRUB to the MBR.
 
Old 05-13-2008, 08:26 PM   #10
calraith
Member
 
Registered: Apr 2008
Location: Gray, TN, USA
Distribution: UbuntuStudio, Linux Mint
Posts: 36

Rep: Reputation: 15
If the regular Hardy CD is not bootable, you could try the alternate install CD.

You could also, from your Hardy CD, hit whatever function key lets you edit your boot options, and remove "quiet" and "splash." That should let you see at what point the boot sequence fails, and give you an idea of another boot command to try to get your system to boot -- something like noacpi if it's getting hung at power management. If you get stuck, tell us where you're getting the kernel panic or whatever.
 
Old 05-13-2008, 09:23 PM   #11
crigaeha
LQ Newbie
 
Registered: May 2008
Posts: 3

Rep: Reputation: 0
Windows and lilo have the bootloader on the first 512, but grub is a big fancy bootloader and won't fit on 512. So they make a 2 stage bootloader. The first stage actually only needs 446. On the rest of the 512 you dd'ed is the partition table.
(Oh noes.)
 
Old 05-14-2008, 06:59 AM   #12
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Originally Posted by crigaeha View Post
Windows and lilo have the bootloader on the first 512, but grub is a big fancy bootloader and won't fit on 512. So they make a 2 stage bootloader. The first stage actually only needs 446. On the rest of the 512 you dd'ed is the partition table.
(Oh noes.)
Whack!!! (Slap on forehead when stupid mistake is pointed out.) Yes, you took out the partition table also. This can--in principle--be recovered, but I think a fresh install is now the way to go. If had any data that was not backed up, then you'll need the recovery tools. (do the recovery before the new install.)
 
Old 05-14-2008, 02:27 PM   #13
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by calraith View Post
If the regular Hardy CD is not bootable, you could try the alternate install CD.

You could also, from your Hardy CD, hit whatever function key lets you edit your boot options, and remove "quiet" and "splash." That should let you see at what point the boot sequence fails, and give you an idea of another boot command to try to get your system to boot -- something like noacpi if it's getting hung at power management. If you get stuck, tell us where you're getting the kernel panic or whatever.
If any one is still around to help, I'm going to try a fresh install from a disc in about 30 minutes or so. Any help would be appreciated for when it decides to hang up during the boot process.
 
Old 05-14-2008, 05:16 PM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,807

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
Quote:
Originally Posted by crigaeha View Post
Windows and lilo have the bootloader on the first 512, but grub is a big fancy bootloader and won't fit on 512. So they make a 2 stage bootloader.
No (modern) loader fits in the code section of the MBR. It's entire function is to locate, load and transfer control to the actual loader code (well, the brain-dead M$oft offering also goes looking for the boot flag, but I digress).
All those mentioned do it differently, but have a similar (high-level) structure.

As for the re-install, there is always some-one passing by. But this is not a support line - help will come when it comes.
 
Old 05-14-2008, 08:44 PM   #15
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 116

Original Poster
Rep: Reputation: Disabled
Weirdest thing- the laptop booted the Kubuntu Hardy CD. I've tried SUSE 10*, Ubuntu Feisty, and some others with failure. So, now I have Hardy. Thanks to all
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB drive... /dev/sda1 doesn't show unless I try mounting /dev/sda as vfat finite Linux - Hardware 8 03-10-2009 12:52 AM
Install lilo on external drive (/dev/sda), then boot as INTERNAL (/dev/hda)? slackware-elf Slackware 3 08-18-2007 04:51 PM
[SOLVED] system disk moves from /dev/sda to /dev/sdm gdevaucorbeil Linux - Hardware 4 03-10-2007 09:30 AM
Sandisk USB card Reader not linking /dev/sg0 to /dev/sda acidraven Linux - Hardware 1 06-19-2004 03:56 PM
boot record backup "dd if=/dev/hda1 bs=512 count=1 of=myfile" csDraco_ Slackware 4 04-20-2003 01:10 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration