1 (edited by gedakc 2016-05-04 22:12:11)

Topic: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hello,

would you appreciate a Hexadecimal Editor for all type of Boot Records on fixed and removable storage devices for "GParted" ?

I programmed a simple bash script, which uses programs already contained in "GParted" (mlterm, Midnight Commander, Xdialog, fdisk, dd), and offers the following features :

- Regarding, Editing, Replacing and Storing (as files) all type of Boot records
- Built-in "Mounting Wizard" for USB keys or other removable (flash) storage devices
- "Treeview" display of devices as selection menu
- Creation of an information file on mouse click with all relevant drive data for documentation and  support
- Linking of used file extensions (.MBR, .PBR., .XBR and .JPEG for screenshots) to "Midnight Commander", thus starting the appropriate viewers.

It goes without saying, that making alterations in a Boot record is work for someone, who exactly knows, what he does. But all other functions are useful for everyone.

I put the program and some screenshots for download on "easy-share". Use the links below, if you are curious.

Treeview menu (screenshot1.jpeg 35KB)

cut-out of drive information (screenshot2.jpeg 51KB)

Volume Boot record (screenshot3.jpeg 243KB)

Bash Script (MC_HxEd 30KB)


Addendum 11-10-08 :
Sorry for the bad download server !  Meanwhile I added more features :

- Access to arbitrary blocks on physical drive with block or CHS (even hexadecimal numbers ) input
- Safe Edit function for Drive ID
- Access to the File ID list of "fdisk" ( Click on every "Filesystem" branch in "Xdialog" treeview )

Here is -- on a better file sharing server -- the newest release (script only):

Bash Script MC_HxEd (40KB)


Addendum 11-11-08:

Added GNU GPL Licence !

This version is for use :  Final Version (43KB)


Addendum 01-02-09:

New Version :

1. New Treeview design with "menue"-item:
- Help ( shows console help )
- Storage devices ( shows a technical overview of all detected drives; generates "Drvs.txt")
- Save Screenshot ( taken by "Gparted" to USB key; renaming avoids overwriting )
- Mount an USB key ( already mounted sticks are ignored )
- Store all Records ( of all detected drives to a USB key; also per drive possible )
- Show Filesystem IDs (= "fdisk" table)
- Refresh ( eliminates also removed, but yet mounted USB keys from the system)
2. Bootflag and Cylinder value/Alignment indicator added to Infofile  "Drvs.txt"
3. Extension ".txt" linked to "mc" ASCII-Viewer
4. Some minor changes in script code

Here is the Download.
Select newest version.

2

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Something went wrong with the links you gave. Could you please double check that ?

3

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hi!

The feature list sounds very nice! I'd really like to see it on an upcoming GParted LiveCD to test it in its "natural" environment (unfortunately, the download links are a bit messed up, si O can't test...).

Thanks a lot for your work!

4

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

I downloaded the files friday evening, so I could upload them elsewhere. Easy-share forces free users to wait quite long between downloads. Unfortunately I can't do it before monday, because the files are now at the job's computer.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

hi class413,

for me, wednesday would be completely fine - I won't have time to test it earlier.
If you have trouble putting the files to some web site, I'd also take them by e-mail... ;-)

6

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

You can find all 4 files in the following compressed file:
http://www.mediafire.com/download.php?wmzjmmdgj22

*** It is highly recommended to backup any important files before doing resize/move operations. ***

7

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Sorry for the inconvenience with the bad file sharing server !  Meanwhile I corrected a bug with the command line parameter processing and added a few new features.  The new version is ready for download on "MediaFire".  I put an addendum with the link to my thread opener, so that nobody has to search the whole posts for that. -

How to get "MC_HxEd" on a working "Gparted" media for testing (remember, it needs programs from there) ?

CD-ROM and USB-Stick : boot with "GParted" medium, mount a plugged storage device, containing "MC_HxEd", copy it to "/usr/bin", edit "fluxbox" configuration file and add menu item. You simply have to right-click on the desktop, choose it ... and here you go !

BTW, Version 0.3.4-11 had the possibility to integrate own programs / scripts or else during boot-up via script file "cdupdate.sh", if it existed. I would appreciate very much a similar option in new releases to "customize" my version ( what I actually did with other, not so simple means ).

8

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

cmdr,
Thanks for sharing your program. Could you add license in your program ? If you do not have any preference, may I suggest GPL ?
It will be easier for us to include your program in the future release of GParted live.
As for "cdupdate.sh", I will try to add that in the future release, too.
Thanks.

Steven

9

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

stevenshiau wrote:

... Could you add license in your program ? ...

Done !  See my first post for the new download link.

cmdr

10

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hi,
Sounds like a very useful script. I would like to use it on my own rescue live CD, but I can't get it to run properly. After I installed mlterm and xdialog, I run the script and see:
"cd: 1001: can't cd to /dev/disk/by-label"
"can't access /dev/disk/by-label/xxx"  <-- multiple times, different directories.
I understand udev creates these by-label directories dynamically as needed?
Maybe the disk just doesn't have any labels.

I get this error after choosing a fixed disk::
" /tmp/mc-root/mcextCsSWsb: 2: $: not found"

I also see a screen complaining about an illegal option -n, line 1029.

My live CD is built from scratch using Ubuntu 8.04 repositories. It has mc, gparted installed. both work fine.
Of course I keep a copy of Gparted Live CD handy, but I wanted to try making my own customized CD with more programs.
Any ideas what is causing my problem?
Thanks.

http://DIYComputerHelp.com

http://LinuxLatitude.blogspot.com

11

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hello fstephens,

"cd: 1001: can't cd to /dev/disk/by-label"
"can't access /dev/disk/by-label/xxx"  <-- multiple times, different directories.

I assume, that these directories do not exist in your distro. The "label" involved is not a Volume label, which might be there or not, but the manufacturers unique label for its drive (e.g. "Toshiba MK3016GAP_A4578..."), which always exists to identify the hardware. Check, if directory ".../by-label" does really not exist and look in your distro, where a comparable specification is stored. If you found something appropriate, we have to adapt the script for you.

I get this error after choosing a fixed disk::
" /tmp/mc-root/mcextCsSWsb: 2: $: not found"

This fault emerges from "Midnight Commander", here especially from the temporary File Extension Repository (allocation extension - opening program). The original file "mc.ext" gets searched once for a specific pattern to split it there and add some new content. Perhaps this pattern does not exist in your distro. The easiest way to correct this issue would be to replace your "mc.ext" with GParted's "mc.ext"

I also see a screen complaining about an illegal option -n, line 1029.

Option -n is used at multiple locations within the script, but only with two commands:  echo -n ... and  read -n ...
Line 1029 is a comment, which does not contain "-n".  I'm puzzled !

Regards
cmdr

12

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hi cmdr,
Thanks for the reply. I am sorry for being so late in my answer.

There is no /dev/disk/by-label, but checking another machine running Kubuntu 8.04, there is. That one definitely does show the volume names that I gave the partitions though. The live CD system does show /dev/disk/by-id & by-path, but not by-label. I get errors like this:
======================================
cd: 1001: can't cd to /dev/disk/by-label
dir: cannot access /dev/disk/by-label/Desktop: No such file or directory
dir: cannot access /dev/disk/by-label/apps: No such file or directory
dir: cannot access /dev/disk/by-label/backup.py: No such file or directory
======================================
I will try the mc.ext file.

I may have made a mistake in assuming the line number of the error was 1029. I looked at the script and of course it is a comment. Here is what I see now when I try to run the script:
The main GUI opens with the tree view, but when I select a drive I get a window with the mcext error and  a GUI box  with a yellow background with the the following message repeating over and over "read: 1029: Illegal Option -n".
This continues until I close all windows. mc also opens as well as a message about mounting. Having never successfully ran the script, I am not sure what sequence these windows are supposed to open, and their exact function.

http://DIYComputerHelp.com

http://LinuxLatitude.blogspot.com

13

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hi fstephens,

I get errors like this:
======================================
cd: 1001: can't cd to /dev/disk/by-label
dir: cannot access /dev/disk/by-label/Desktop: No such file or directory
dir: cannot access /dev/disk/by-label/apps: No such file or directory
dir: cannot access /dev/disk/by-label/backup.py: No such file or directory
======================================

First of all, I was wrong and you were right : disk label is the volume name ! I confused it with disk ID in my answer. The above error message proves, that this directory doesn't exist. The appearing file names come from the current directory of your environment, which is used instead. They have nothing to do with my script. Do you know an other location (file or directory) in your distro, where the disk labels of your drives get stored by the system or perhaps a simple Linux command for this purpose ?

To skip this difficulty for the moment , just add

lbl0="N.N"
lbl="${lbl0}_"
return

as first three lines to subroutine "disk_lbl" (line 625 ff.)

I will try the mc.ext file.

I think, this will suppress the cyclic error messages. Be sure, that it is stored as "/etc/mc/mc.ext". To automatically adapt "mc.ext" was the only way to get "mc"-Editor start in hexadecimal view. Therefore it's the first action (only once per session) , if you click on anything within the GUI.

Good luck
cmdr

14

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hello,
I just added a new version (0.1.1-2) of "MC_HxEd" to this thread. See my first post.
To test it, download it to an USB key, mount the key to a running "GPartedLive" (> 0.3.9-13) and copy "MC_HxEd" to "/usr/bin" (overwriting the old version). Start it with "fluxbox" or click on it.

Happy New Year
cmdr

15

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Would you be interested in adapting this to work on Parted Magic? We'll give you any credit you require.

I think we are ready have most of the requirements, but it looks like some things may need to be tweaked.

16

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

New version of "MC_HxEd" (0.0.1-3)

Since "MC_HxEd" did not work with new ISO-hybrid-bootable USB sticks, I had to update it.
Here is an overview of its features compared to the first version, which is still contained in "GParted Live" up to now.

1. Menu tree
- Help                                shows console help text
- Storage devices                shows (and stores) data of all detected drives (drvs.txt)
- Mount USB stick                mounts USB stick for storage (@ /mnt/usb)
- Save or take Screenshot    saves screenshot to USB stick (renaming avoids overwriting)
   ( Screenshot function startable here; creating "PNG" format, instead of "JPEG" )
- Store all Records               saves Boot Records of all detected drives in one step
- Show Filesystem IDs          shows "fdisk"-table with storage option
- Suppress Help window        shows no help window
- Refresh                            restarts "MC_HxEd" to detect new drives

2. Drive tree(s)
   New treeview design
  - each device starts a new tree
  - logical drives are a branch of the assigned extended partition
  - New item : storage of all Boot Records of one physical drive

3. Technical features
  - Bootflag and Cylinder values / alignment indicator added to "drvs.txt" (former "drvs.dat")
  - Extensions ".txt" and ".png" linked to "mc"
  - Partitions are ordered due to disk order in treeview and "drvs.txt".
  - Gaps (unallocated/hidden spaces; unusable slack) are calculated and displayed in treeview and "drvs.txt"
  - Extended Boot Record files (XBR) get filename with sectornumber to find them easier with "Show_Block(s)"
  - Program adapted to new "ISO-hybrided" USB sticks
  - New flashing "busy" indicator
  - Some minor changes in script code

Download "MC_HxEd" here

Some screenshots :

1. New menue
http://www.mediafire.com/imgbnc.php/da1ebea6dc3847528396d49a5e5840745g.jpg

2. Treeview with extended partition
http://www.mediafire.com/imgbnc.php/0e248fc382ba1fc1dce7a8e5b290507b5g.jpg

3. Treeview with partitions, not in disk order
http://www.mediafire.com/imgbnc.php/48c80e0c025054181db3c75c1283cb815g.jpg

Regards
cmdr

17

Re: [closed] Hexadecimal Editor for Boot Records (Suggested trial version)

Hi cmdr,

MC_HxEd appears to be broken on the latest GParted Live 0.6.4-1 image.

When I try to run "sudo MC_HxEd", I receive the following messages:

     This script needs
     Midnight Commander (/usr/bin/mc)
     gdialog (/usr/bin/gdialog)
     for proper function. Script aborted.

Since both /usr/bin/mc and /usr/bin/gdialog appear to exist, would you be able to investigate to determine the cause?