LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-11-2015, 10:58 PM   #1
mazinoz
Member
 
Registered: Mar 2003
Location: Mansfield Queensland Australia
Distribution: Linux Mint - Tara
Posts: 497

Rep: Reputation: 35
fdisk a drive that has been completely written over including mbr


I overwrote an external drive completely with

dd if/dev/urandom of=/dev/sdb

In the past I think I partitioned it with fdisk, format or with gparted.

Now however, neither W7 or linux recognises the device. Same problem with a USB stick.

Any help to get these devices partitioned appreciated.
 
Old 09-11-2015, 11:05 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
In short you've destroyed its contents completely.
So you start at partitioning the device using fdisk or any tool you like to use.
Seen http://tldp.org/HOWTO/Partition/fdisk_partitioning.html ?
 
Old 09-11-2015, 11:54 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
I think the OP has tried - it used to be fdisk was pretty dumb and would work fine after zapping the disk. Now it does a lot more checks - some of which may get in the way.
Maybe try a parted script to write a partition table.
 
Old 09-12-2015, 06:02 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Ah. I think this happens because fdisk believes the disk has real data rather than random data.

Try "dd if=/dev/zero of=/dev/<whatever the disk is> bs=1M count=1". This should zero the first 1 MB of the disk (where the partition table would be, as well as any data in the first partition).

I had this problem after a hardware raid initialised some disks for itself. When I tried to use the disk without the controller fdisk wouldn't process the disk. Zeroing the beginning of the disk allowed things to work.
 
Old 09-12-2015, 03:33 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Now however, neither W7 or linux recognises the device. Same problem with a USB stick.
Would this be a USB connected device?

Maybe the problem lies with the USB port or cable?

Time for some experiments, I think. Try with a different computer, and /or a different USB cable.
 
Old 09-12-2015, 07:06 PM   #6
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
What do you mean by won't recognize the disk? Have you tried gparted on it? You should be able to use it to add a new partition table and filesystem to the drive.
 
Old 09-12-2015, 10:28 PM   #7
mazinoz
Member
 
Registered: Mar 2003
Location: Mansfield Queensland Australia
Distribution: Linux Mint - Tara
Posts: 497

Original Poster
Rep: Reputation: 35
One device is an external drive connected via USB to laptop, the other a USB stick. If I do lsusb neither is found. Gparted doesn't show up anything other than the laptop hard drive. After doing overwriting I rebooted using a clean Linux Mint 17.2 disk before partitioning either external drive or USB stick. I've managed in the past to partition or load a filesystem onto USB stick and drive but have forgotten how I did it.
 
Old 09-12-2015, 10:32 PM   #8
mazinoz
Member
 
Registered: Mar 2003
Location: Mansfield Queensland Australia
Distribution: Linux Mint - Tara
Posts: 497

Original Poster
Rep: Reputation: 35
I've just logged in. I think it was parted I used, will report back after I have tried that.

Thanks everyone.
 
Old 09-18-2015, 11:19 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by mazinoz View Post
If I do lsusb neither is found. Gparted doesn't show up anything other than the laptop hard drive.
afaiu, your problem is to find the drive, so that you can perform the dd thing described in post #4 (which i can confirm has helped me, too, in similar cases).
several ways:
- type "dmesg" in a terminal. have a good look at the last lines.
- plug in the drive. wait a minute.
- type "dmesg" again. look at the new lines. chances are it will tell you something about a new device, and where it resides (most probably /dev/sdXX).

you can do something very similar with "ls /dev".

you can also try "sudo fdisk -l".
 
Old 09-20-2015, 07:29 PM   #10
mazinoz
Member
 
Registered: Mar 2003
Location: Mansfield Queensland Australia
Distribution: Linux Mint - Tara
Posts: 497

Original Poster
Rep: Reputation: 35
Thank you everyone for your help,and my delay in replying to last post here. This is so embarrassing. I tried dmesg with and without the cable plugged in. Same message each time. I then tried to use a different cable with the external hard drive but the manufacturer in their wisdom made the drive plug so it only fits their cable. So I reinserted their cable and the device lit up and was found! I haven't had any issues in the past like this. First time I used dd on this drive so thought it was that. Now I have an external Backup drive, such a relief. Once again thank you.
 
  


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
can't seem to stop clonezilla from including MBR in partition image jtwdyp Linux - General 3 06-05-2012 03:42 PM
Ability to restore Windows 7 including mbr w/dd after linux install? coldbeer Linux - Laptop and Netbook 5 08-12-2011 08:37 PM
fdisk or do I need to do something completely different? BIGCATBobcat Linux - Newbie 10 06-24-2010 03:22 PM
MBR over written... boot floppy doesn;t work sodhilogin Linux - General 5 07-19-2004 06:27 AM
why won't my mbr fdisk /mbr? jamessp007 Mandriva 13 01-03-2004 01:41 AM

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

All times are GMT -5. The time now is 02:23 AM.

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
Open Source Consulting | Domain Registration