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. |
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.
|
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. |
You could build a modified file mbr2.bin
That way, you add the rest of the file from mbr.bin after the truncated part. |
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/
|
x-y-problem.
WHY do you THINK you need to erase an entry in the partition table? |
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.
|
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?
|
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. |
All times are GMT -5. The time now is 02:39 PM. |