LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 08-20-2005, 09:44 AM   #1
linuxchump
LQ Newbie
 
Registered: Mar 2005
Posts: 10

Rep: Reputation: 0
Use 'dd' to wipe only partition table


Hi! I've been trying to wipe a partition table using 'dd' but having problems.

dd if=/dev/zero bs=1 seek=446 count=64 of=dd_image_file


This truncates the file to 64 bytes in size

I want to keep file size original (8GB) but wipe only the partition table which is 64 bytes in size and 446 bytes into the image file. I've tried variants, such as;

dd if=/dev/zero bs=64 seek=446 count=1 of=dd_image_file

etc. But everything thus far truncates my file. Can anyone point out what I'm doing wrong here with my dd command?

regards,

-LC
 
Old 08-20-2005, 09:49 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Is there data you want to keep on this drive? If not and your only wanting to remove the partition table, doing a simple:

dd if=/dev/random of=/device/path bs=512 count=1024

I'm just really confused what your trying to accomplish by wiping such a small partition table..
 
Old 08-20-2005, 09:55 AM   #3
linuxchump
LQ Newbie
 
Registered: Mar 2005
Posts: 10

Original Poster
Rep: Reputation: 0
I have an image of my drive. I want to use 'dd' to wipe only the partition table, for test purpose. I know I can back up only partition table by;
dd if=/dev/drive bs=1 skip=446 count=64 of=partition_table


I thought I use 'dd' to wipe only range of data in a file, here the partition table. Can it not be done on a file, but only a physical device?

thank you,

-LC
 
Old 08-20-2005, 10:48 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Have you considered sfdisk? You can use that to dump the partition table to a file, make some changes and dump from the file back. Needs to be done as root user.

For example:

sfdisk -d /dev/hda >file.txt

sfdisk /dev/hda < file.txt
 
Old 08-20-2005, 11:03 AM   #5
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
Re: Use 'dd' to wipe only partition table

Quote:
Originally posted by linuxchump

I want to keep file size original (8GB) but wipe only the partition table which is 64 bytes in size and 446 bytes into the image file. I've tried variants, such as;

dd if=/dev/zero bs=64 seek=446 count=1 of=dd_image_file

etc. But everything thus far truncates my file. Can anyone point out what I'm doing wrong here with my dd command?

regards,

-LC
This is wrong since it would seek 446*64 bytes (bs=64)


Quote:
Originally posted by linuxchump
Hi! I've been trying to wipe a partition table using 'dd' but having problems.

dd if=/dev/zero bs=1 seek=446 count=64 of=dd_image_file


This truncates the file to 64 bytes in size

This command is right. dd truncate the file mentioned by "of" by default.

i quote from the dd manpage

Quote:
Originally posted by dd.1
of=file
Write to file instead of standard output. Unless conv=notrunc
is given, dd truncates file to zero bytes (or the size specified
with seek=).
so all you need to do is add conv=notrunc

dd if=/dev/zero bs=1 seek=446 count=64 conv=notrunc of=dd_image_file

and it should work.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
How do I wipe my windows partition, and keep my Linux? walterbyrd Debian 1 07-21-2005 10:46 PM
Wipe partition table rook Linux - Software 1 01-04-2005 10:45 PM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM
Windows partition has bad sectors. Will 'dd' work in place of low level format? gkneller Linux - Software 5 02-26-2004 11:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:01 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
Open Source Consulting | Domain Registration