[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

OPENING A HARD DISK FILE ON MAC OS X USING C/C++

Posted on 2004-10-27
5
Medium Priority
?
286 Views
Last Modified: 2013-12-26
hi experts
  I have tried to read the hard disk on mac os x But failed. I have use the fopen(), fread(),fwrite() to read the hard disk. I m able to read any .txt and .doc file on mac  using these functions. Becasue hard disk is also represented as file /dev/rdisk0 but i unable to even open this file using fopen().
device permissions on this file are
crw-r----- root   operator     /dev/rdisk0

plz help me why this file is not opened.
best regards
0
Comment
Question by:ManojKrChauhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 500 total points
ID: 12423603
The 'r' in /dev/rdisk0 stands for 'raw'.   You cannot open it as a regular file.
You must mount the raw image first.  And you cannot mount the raw disk
image of any currently mounted volume - especially the root or boot volume.
For more information on how to read and write raw volumes, examine the
Darwin source code for diskutil and hdiutil.

But I am really at a loss to understand why you wish to open a raw disk
device using fopen().  This task is in the realm of people writing operating
systems and disk repair/recovery utilities.  These require an extensive
knowledge of devices, drivers, disk partitioning mechanisms, and file system
formats --- considerably more knowledge than you have exhibited in your
question.
0
 

Expert Comment

by:manojchauhan
ID: 12441443
hi experts
plz tell me where i can find the Darwin source code for diskutil and hdiutil as u said this will help me
thanx
0
 

Expert Comment

by:manojchauhan
ID: 12441466
I have two hard disks attached with my system
/dev/disk0
#: type name size identifier
0: FDisk_partition_scheme *18.6 GB disk0
1: DOS_FAT_32 NO NAME 9.8 GB disk0s1
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_Driver43 28.0 KB disk1s2
3: Apple_Driver43 28.0 KB disk1s3
4: Apple_Driver_ATA 28.0 KB disk1s4
5: Apple_Driver_ATA 28.0 KB disk1s5
6: Apple_FWDriver 256.0 KB disk1s6
7: Apple_Driver_IOKit 256.0 KB disk1s7
8: Apple_Patches 256.0 KB disk1s8
9: Apple_HFS Macintosh HD 55.9 GB disk1s9

and the file permissions of these device files are
brw-r----- 1 root operator 14, 0 28 Oct 11:41 /dev/disk0

brw-r----- 1 root operator 14, 1 28 Oct 11:41 /dev/disk1

I have tried to change the permissions through root but message is
chmod o+r /dev/disk0
chmod: /dev/disk0: Operation not permitted

Is there any need to change the file permissions for reading hard disk.
plz tell how i have to proceed and give solution to the problem described.
thanx
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question