LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 11-07-2017, 02:31 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
How do I erase an entry in the partition table?


I guess I need some kind of an editor. There was one for MS-DOS, named pctools.

EDIT: i did dd if=/dev/sda of=mbr.bin bs=512 count=1
With 'hexdump -C mbr.bin' I saw the entry offset is 1BE. I could blank the entry using dd itself /dev/zero, but it's too risky. I need to be able to edit mbr.bin. Then I write it to disk with dd.

Last edited by stf92; 11-07-2017 at 02:44 PM.
 
Old 11-07-2017, 03:04 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,147

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
You could use gparted for a graphical tool, or gfdisk for a good command line tool, or fdisk for the most basic partition editor on Linux. Making a backup like you did with dd is a good idea before you edit the partition table. You should save it to a USB stick.
 
Old 11-07-2017, 03:31 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thanks. Gparted I must first write it to a pendrive. I saw vi can do it with :%!xxd But when I use this command, the buffer completely changes. I don't understand!

EDIT: Also I did
dd if=/dev/zero of=mbr.bin bs=1 count=16 seek=446

but dd erases truncates after the last byte written. That is, the new file changes to 446+16 bytes long.

Last edited by stf92; 11-07-2017 at 03:34 PM.
 
Old 11-07-2017, 04:02 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
You could build a modified file mbr2.bin

That way, you add the rest of the file from mbr.bin after the truncated part.
 
Old 11-07-2017, 09:29 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
I might be tempted to use a partition editor like ranish on ultimate boot cd to usb if tools like fdisk or others won't work. https://www.howtogeek.com/106873/how...ions-on-linux/

Last edited by jefro; 11-07-2017 at 09:31 PM.
 
Old 11-08-2017, 12:34 AM   #6
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
x-y-problem.

WHY do you THINK you need to erase an entry in the partition table?
 
Old 11-08-2017, 11:46 AM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
If you have a live disk or usb stick of Linux, you should find it has Gparted on it. As a Slacker, you probably won't have one, but getting and keeping something like SystemRescueCd or GParted Live is generally a good idea for system repair and data rescue.
 
Old 11-09-2017, 07:24 AM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
I tried gparted but it fails to recognize the partition table though I am using one of the partition right now. I laughable not being able to do such a simple thing as this. I want to write 0x274ef5278 at offset 45 in a file and I can't. Is there not a program to do this?
 
Old 11-09-2017, 08:11 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,739

Rep: Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921
If you want to write a few bytes to a file why not use a hex editor?

bless, ghex, khex, emacs, vi are just a few.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What is this strange gateway entry in my routing table? taylorkh Linux - Networking 7 10-09-2019 03:43 AM
Trying to get max and min for each entry in a table kmkocot Linux - Newbie 3 11-28-2015 07:43 PM
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
Routing table entry Ifurita1981 Linux - Networking 6 03-25-2007 02:53 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:00 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