LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-04-2013, 12:14 PM   #1
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 777

Rep: Reputation: 40
View contents of disk drives in hex


I'd like to look at the contents of a FAT formatted SD card. I want to look at the hex values in all parts of it as I'm trying to write some software to access SD cards on an embedded micro.

I remember years ago using DOS there were programs to do this. I must say I'd prefer a GUI if at all possible.

To be clear, I don't want to dump a file's contents to a text file, I want to look at the raw data on the disk drive, so I can look at partition tables etc. I have vaguely gleaned that dd will do it, but I'd really much rather have a GUI.

Thanks!
 
Old 01-04-2013, 01:48 PM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 2,601

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
Be careful with dd, it is unforgiving, it will overwrite a partition if you mess up. Something like.
Code:
sudo dd if=/dev/sda of=mbr bs=512 count=1 && ghex mbr
https://live.gnome.org/Ghex
 
Old 01-04-2013, 02:18 PM   #3
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 777

Original Poster
Rep: Reputation: 40
Ghex just shows file contents, it doesn't enable you to look at raw contents of things like FATs. It's the kind of thing that would otherwise be perfect!

Last edited by DiBosco; 01-04-2013 at 02:20 PM.
 
Old 01-04-2013, 03:04 PM   #4
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 2,601

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
My example was the first 512 bytes of /dev/sda (The MBR)
You could also use
Code:
sudo less -f /dev/sda
Code:
sudo cat /dev/sda | less
 
Old 01-04-2013, 03:10 PM   #5
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,055

Rep: Reputation: 78
It's been a very long time since I took a class that described file systems -- and that dealt exclusively with rotating disk storage -- but I seem to recall that your operating system will have a lot of drivers that manage storage blocks and such -- i.e., your "file systems". For dealing with hardware connected to a USB port, I would imagine there's some kind of socket-like data protocol and that the machine has its own internal workings that might respond to commands. This discussion looked marginally useful:
http://ubuntuforums.org/showthread.php?t=1163395

Perhaps there's an RFC for USB data storage protocols?
 
Old 01-04-2013, 07:04 PM   #6
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 777

Original Poster
Rep: Reputation: 40
Thanks folks, the less thing is ish what I'm after, but I really want it in a nice GUI easy to read interface, just like GHex. I'd be amazed if there wasn't exactly what I was after!

sneakyimp, I have learned a lot about FAT and I think I know what I am looking for, it's not the learning of how it works so much as just wanting to see raw data. When I start reading the data off the SD card with my embedded system, then I'll know exactly whether I am reading stuff back correctly.
 
Old 01-04-2013, 08:01 PM   #7
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 777

Original Poster
Rep: Reputation: 40
Sussed it, hexedit is pretty much perfect.

You can type:

hexedit /dev/sdb1

And that will display stuff rather like GHex, hex values and ASCII values side by side. Would be nice if you could jump to a certain address, but you can at least scroll up and down though the whole drive. Cool!
 
Old 01-04-2013, 08:49 PM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,003
Blog Entries: 1

Rep: Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847Reputation: 847
Do you absolutely have to look at realtime data without "making a copy" and looking at the copy? dd + hexdump + gui text viewer. Or do you want something like debug.exe from the olden days of 16 bit assembler coding in dos / windows. (which is probably still shipped in modern flavors of windows, despite it's 16 bit-ness)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
View the contents of boot floppy disk dyool Ubuntu 3 10-01-2006 01:45 PM
How to use GUI to view contents of Windows disk myfokkinnick@yahoo.i Ubuntu 5 05-09-2006 11:58 AM
View Contents of Hard Drives using DSL and Knoppix, How? Anthony1uk Linux - Newbie 1 10-08-2005 07:58 PM
how to view contents of various partitions on disk skvasistha Linux - Software 1 11-23-2004 08:53 AM
view text file in hex under kdevelop tcma Linux - Software 1 10-20-2004 06:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration