[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix the destroyed disk image partition table in a raw image file usi
From: |
Gregor Zattler |
Subject: |
Re: Fix the destroyed disk image partition table in a raw image file using Emacs. |
Date: |
Sun, 11 Apr 2021 21:18:03 +0200 |
Hi Hongyi Zhao,
* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-04-11; 21:34]:
> $ dd if=disk.img bs=1 count=4 skip=440 2>/dev/null | od -t x4 -An
> 761b36b0
>
> It's well known that Emacs is an 8-bit clean editor which makes it
> safe to edit binary files. So, I want to whether I can fix the above
> destroyed disk image file with Emacs for my scenario.
If your emacs is able to handle the disk image in memory
(which probably means you need a 64bit emacs and enough RAM
installed) you could open the file of the disk image with
find-file-literally
Visit file FILENAME with no conversion of any kind.
Format conversion and character code conversion are both
disabled, and multibyte characters are disabled in the
resulting buffer. The major mode used is Fundamental
mode regardless of the file name, and local variable
specifications in the file are ignored. Automatic
uncompression and adding a newline at the end of the file
due to require-final-newline is also disabled.
And then the first thing to do would be
binary-overwrite-mode
When Binary Overwrite mode is enabled, printing
characters typed in replace existing text. Newlines are
not treated specially, so typing at the end of a line
joins the line to the next, with the typed character
between them. Typing before a tab character simply
replaces the tab with the character typed. C-q replaces
the text at the cursor, just as ordinary typing
characters do.
You then can move point in the disk image to the desired
place and type in whatever you want and later save the
buffer to its file.
Ciao; Gregor
--
-... --- .-. . -.. ..--.. ...-.-