Read sector on boot disk

This is a continuation of my question about reading the superblock .

Let's say I want to target the HFS + file system on Mac OS X. How can I read sector 2 of a boot disk? As far as I know, Unix provides only system calls to read from files that are never stored in this place.

Is it required: 1) a program to start kernel mode, or 2) a program that will be written to the assembly? I would prefer to avoid any of these limitations, especially the latter.

+4
source share
4 answers

On Linux, you can read from a special device file /dev/sda, assuming that the hard drive you want to read is the first. You need to be root to read this file. To read sector 2, you are simply trying to compensate 2*SECTOR_SIZEand read in SECTOR_SIZEbytes.

I do not know if this device file is available in OS X. Check for interesting file names under /dev, for example, /dev/sdaor /dev/hda.

+5
source

I did it myself on a Mac, see the disk editor tool: http://apps.tempel.org/iBored

/dev/diskN /dev/rdiskN (N - , 0). lseek (, 64- !) / .

, "ls/dev/disk *", , . , "sM", M - . , .

"xxd" "dd" , . .

, root. , . . unmount "diskutil".

, .

2017: OS X 10.11 SIP .

+6

I was also going to suggest hitting the / dev / device file for the volume, but you can refer to Amit Singh, who wrote hfsdebug utility and probably did exactly what you want to do.

+1
source

How does it work in terms of permissions? Wouldn't read / dev / ... be insecure since if you read far enough you can read files for which you don't have read access?

0
source

All Articles