User Mode Block Device Driver

Hi,
I want to write a block device driver in user mode so that the read and write calls from the FileSystem comes to user mode component than a regular kernel mode driver.
why i want to do this ... because I want to pass on the data coming to another apps and the data is near real time and large. So, I can't keep the block driver in kernel mode and do transfer of data from kernel mode to user mode.
Can this be done ... ? I have been looking at various things but nothing comes close. Any hints will be helpful.
Thanks
Tarrot .

Well. The 2 user apps cannot talk directly as User APPs2 only understands block I/O requests as input so it has to have a FS over it which is ext3. User APPs1 is an application that runs over FS and writes to it like windows explorer.
The Problem is I am not able to find a way to write a user mode block driver. Why I want this to be user mode so that I can interface to Virtual disk below which is a user mode application, i.e. User Apps2.
I can write a kernel mode block driver there but it would not be efficient as I will have to push it from kernel mode to user mode for userapps2.
I hope it explains....

Similar Messages

  • Single User Mode - mount external drive and make it r/w

    How can I access a USB disk and make it read/write?
    I can't +mount -uw /Volumes/"Time Machine Backups"+ because it says that the disk is a special type.
    Can I just use chmod because the disk is automounted?
    When I attempt to chmod my USB disk, I get this message:
    chmod: /Volumes/Time Machine Backups: Read-only file system
    chmod: /Volumes/Time Machine Backups/.autodiskmounted: Read-only file system
    I know that I can cp from the internal disk, since I can cat the pictures to the terminal. But I can't make the external hard disk writeable.
    I need to do this from single user mode, because the machine won't boot from the DVD.
    -Michael

    Just got back from the apple store. The genius found these things:
    * My DVD is fine. It loaded in another computer
    * My computer is mostly fine, except for the hard disk. It was able to boot off of an external Firewire disk.
    * The DVD drive is fine. When the computer was booted off the external disk, it was able to mount my DVD.
    * The internal HD is definitely bad. Drag/drop copy to an external HD was going to take 3 hours for about 30 files. Disk Utility shows it in red.
    * He suspects that the failing HD prevented the machine from being able to load a DVD. (?)
    His advice:
    1 Buy a new 2.5" SATA disk at Frys.
    2 Buy a USB sled for the old disk
    3 Replace the failing HD in the laptop with the new, unformatted disk
    4 Boot from the OS X DVD
    5 Install the OS from the DVD
    6 Reboot from the internal HD
    7 Insert the failing HD in the sled, and connect it to the computer once it's booted off the new HD. Copy everything from the /users directory
    8 But a new HD for the sled and use it for Time Machine backups
    9 Teach the daughter the importance of regular backups
    Let's hope this works.

  • Single User Mode - mount external drive and copy user files to there

    I have an iBook G4 running (I think) Tiger (although it may be Panther). AHT reports a bad HD and it will not boot from that drive. Mounting it via Target Disk to another Mac won't permit me to even see beyond the root directory; just a spinning sunburst at the bottom of the Finder window.
    If I boot into single-user mode, I can "ls" and "cd" to see the files and folders in the home folder. Assuming the HD is named "Macintosh HD" and I have a USB-connected hard drive named "Backup", what are the commands I need to use in single-user mode in order to mount "Backup" and copy the user's home folder (there's only one on this drive) over to "Backup"?
    As I indicated above, I'm not absolutely sure whether this iBook is running Panther or Tiger.
    Thanks in advance for any assistance!

    I'm in the middle of copying things.
    I did a chmod -R ug+w (IIRC) to the 300GB volume and this made it writable.
    I then CD'd to the Pictures folder on the Macintosh HD.
    I then did a cp *.jpg /Volumes/300GB/ and found that it managed to copy all of the jpegs that were sitting loose in the Pictures folder. Some of the photos were corrupted but I expected this as the drive is reported to have a hardware issue by AHT.
    I'm now in the process of copying the iPhoto Library using the cp -r command. Some files are being reported as bad and can't be copied but, again, I'm expecting this.
    Whatever I can get from this drive will be a bonus. I'll mention that I used Drive Genius to duplicate the HD to a disk image and, while this was done successfully, it resulted in a "no filesystem" error when I attempted to mount it. However, I -did- ask for it to be mounted anyway and then used DiskWarrior on it (even though it didn't appear in the Finder). It took a few hours for DiskWarrior to come up with a "preview" of the disk (as the filesystem was thoroughly hosed). The User folder was nowhere to be found and every file that was displayed was corrupt. That's why I'm trying this "out of the GUI" process.
    I'll thank everyone who made suggestions; they all pointed me in the proper direction.

  • Signal the user application from device driver

    Hi All
    How can the driver send a signal to the user level application.
    Thanks

    proc_signal() looks promising to me, only if I understand it right. Which I am not sure. Here is what:
    If an application makes an ioctl(), that would be the current process - right?
    than, proc_ref() should return a unique handle to THIS process. Now, this handle can be used in proc_signal() to send a signal to the application.
    If there are more than one process, the driver will have to come up with a policy to send signals to one or more of these processes.
    comments?
    Thanks
    If you are thinking about some kind of a IPC between
    user/kernel land. How about the user app send down a
    ioctl that the driver holds until an event occurs then
    completes it. Of course you would need a way to
    cancel the ioctl, in case the app blew out, but that
    can be done.

  • Can I mount a firewire device in single user mode?

    I've still got this idea I can rescue data from a hard drive that won't mount.
    I put my external backup drive on another iMac to simulate what would happen. Briefly,
    I plug in the drive, note the device name.
    I reboot into single user mode.
    The drive automatically powers off. Grrr.
    I turn it back on again. It does not show up in /dev

    How far did you go under "single user" mode? In "Tiger", running 'sh /etc/rc' (instructions to use this are included among the messages displayed starting up in single-user mode) starts up all sorts of things. Perhaps plugging in the drive after the script has run will have it show up in '/dev/' (I haven't tested this)...

  • To mount a CD-ROM in Single User Mode.  How?

    Thank you for reading my question. 
    I need to run single user mode on my iMac because of a disk problem.  I would like to be able to mount the cd drive while I am in single user mode.  I would also like to be able to mount usb hard drives with confidence, so that I can copy off files from the internal hard drive. 
    I am in single user mode, which I get to by holding down Command-S on startup.  I can look at the disks that are attached to my computer by executing
    ls -l /dev/disk*
    However this appears to be adding disks.  I started with /dev/disk2 and /dev/disk2s1 etc which I understand are partitions on that external drive.  Now when I list /dev/disk* I have /dev/disk3 and a couple of partitions on those devs.  Is that normal?  Have I not unmounted disks properly?
    I have been using a directory that already exists as the mount point for my usb drives using
    mount -t hfs /dev/disk1 /cores
    which worked fine.  Alas the disk I mounted on that directory was too small.  Now I can't mount a disk on there.  Do I need to unmount or fix up that assignment? 
    If I were to create a directory in /Volumes is that advisable?  How do I make the root directory readable is that by using 'mount -uw'? 
    Thank you.  Please if you answer my question, try to be clear on what commands to use and why.  Bear in mind that other people will read this, and no one on the web seems able to write suggestions very clearly.  Maybe we can be the first!  If I have not been clear, please feel free to ask for clarification.  i am not a total unix newbie.  Rather in the 20 years since I was a sysadmin, my memory has faded. 
    Pete

    I think you need to post this in a different forum.  I think the Developer Forums would be the right choice.
    In any event from the little Unix I know you can't mount a removable device until it's connected which means you need to put a CD/DVD into the optical drive.  At that point if you enter 'df' you should see the device if it is mounted automatically (which I believe it does.)
    In single-user mode the entire drive is readable and all files accessible.  You are the 'root' user.  In order to put the system into write mode you must enter 'mount -uw /'.  Note the '/' at the end of the comnmand line.  That makes the entire system writeable.
    You do not need to create a directory in /Volumes.  When the CD/DVD is recognized an entry in /Volumes will appear unless the disc is unformatted.
    Now take some of the above with a grain of salt.  I'm certainly no Unix expert.

  • Single-user mode: How to mount and access an external USB drive?

    My MacBook Pro HD is acting up. Cannot boot normally or into "safe mode". Cannot reinstall OS without wiping out the HD. Need to recover some critical files but DiskUtil First Aid and Restore options cannot successfully complete. Problem traced down to "invalid node structure" which means I either have a hardware problem or my filesystem partition directory structure is corrupted. I need to recover some files that are not backed up (timin issue with my regular backup process).
    I can boot into single-user mode, mount the root file system (/sbin/mount -uw /) and can see/navigate the rot filesystem structure via good UNIX command line. Here's what I would like to do (in single-user mode):
    1. Mount an external USB drive (250 GB already formatted as Mac OS X Extended)
    2. Copy various files and/or directories from my HD to the external USB drive (UNIX cp command)
    I realize I could go spend $$ for the Disk Warrior or Data Rescue products (or something similar) that SHOULD help me recover my HD or files, but it seems silly to do this when I can see, touch and taste them from within single-user mode....
    Comments? Suggestions?
    TIA --
    Trent
    P.S. Once I've recovered my files, I'll try to reformat the HD and then reinstall the OS. And THEN go have Apple look at my machine (thank goodness for AppleCare coverage)!

    Resolution:
    1) Boot system in single-user mode (SUM) with external HD attached.
    2) Execute the following UNIX CLI commands once SUM boot process is completed:
    # fsck -fy
    # mount -uw /
    # mkdir /Volumes/target_directory
    # mount -t hfs -w /dev/diskXXX /Volumes/target_directory
    # cp -RXv /source_directory /Volumes/target_directory
    Where XXX is the device-level name for your external HD's data partition. In my case this was /dev/disk1s2. It may take some experimentation to identify this device name if your system has multiple HD's.
    3) Verify contents were successfully copied onto the /Volumes/target_directory.
    Comments and observations:
    - Do NOT use "/" as your source directory - cp will make a second (redundant) copy of /volumes/target_directory
    - I was able to successfully copy ALL files off my HD despite the fsck command's "invalid node structure" error message with this simple procedure. YMMV, depending on the state of your HD.
    - The repeated disk0s2: I/O error warnings displayed during the SUM boot process did not seem to have a negative effect on this procedure. I also received this same error warning intermittently as I navigated the mounted filesystem did not seem to be a problem, either. Again, YMMV.
    Commercial software:
    I downloaded ProSoft Engineering's Data Rescue 3 product (trial version) before spending $99 to attempt to recover my "bad" HD's data via mounting to a good system with FW target mode. It could not successfully complete its "QuickScan" process and immediately hung on block 0 of 390M during its "Deep Scan" process. The product did seem to function properly on an operational system. ProSoft's technical support was responsive and helpful but had no answer for my "Deep Scan" error.
    I did not attempt to use Alsoft's Disk Warrior 4 product. I could not find any trial software available and was reluctant to spend $100 based upon the mixed reviews and comments on this discussion forum as well as other reviews. Alsoft does claim to address the "invalid node structure" error in their marketing materials. Hindsight being 20/20 - I saved $100 by using this simple procedure.
    Final note:
    Neither Leopard nor Snow Leopard's installation DVD could recognize the bad internal HD when trying to do a reinstall. While DiskUtil was able to "see" the bad internal drive it immediately failed when I tried to do an "erase and format". Took the system to my local Apple store and the Genius ran a tool called "SMART Utility" from Volitans Software (www.volitans-software.com). SMART utility confirmed that my HD was bad so it was replaced. AppleCare pays for itself (once again!).

  • Mount device via USB in single user mode

    Hi.
    Help much needed. My macbook pro appeared to be crashed with harddisk problem
    at start time... unable to boot to normal login screen.
    When I run in single user mode, I dont seem to see my thumbdrive, or external device.
    I connected them via the USB ports on my Macbook pro (17")(Snow Leopard)
    I checked /dev/disk* and saw only disk0 (disk0, disk0s1, disk0s2, disk0s3).
    I never get to see disk1 no matter what I tried. (I've various MSDOs format,
    or NTFS format disks).
    I followed the advise here:
    http://www.insanelymac.com/forum/index.php?showtopic=232365
    Am I supposed to be able to see the drive the moment I connect it to the
    port?
    Thanks.
    Marc

    When I insert the disk, the root prompt would come telling me the USBMSC message. So, it does know I inserted the external drive. But yet, no new refresh of the /dev.
    The device should be listed in /dev after the USBMSC message whether you mounted the root file system write or not.
    $ ls /dev/disk*
    /dev/disk0 /dev/disk0s1 /dev/disk0s2 /dev/disk0s3
    Either the boot partition table is APM or GPT with two partitions.
    I went to /Volumes and able to read the directory of files that I want to copy.
    You should stay out of the /Volumes directory. Reference your path like->
    ls -l /Users/<your name>/Documents/
    And avoid creating mount points in the /Volumes directory. It is used by diskarbitration.
    At this point, I would stop running fsck_hfs on the device (or any other utility) and either try to mount the drive via firewire disk mode or have someone block copy the disk.

  • Single User Mode: Still waiting for root device

    iMac G4.
    I reset the NVRAM, PRAM. It won't attempt to boot from anything but a OS 10.4 cd; booting from OS 9 cd just leaves me at the flashing question mark icon.
    If I try to boot from OS X cd, it comes back with the prohibitory sign.
    If I try to boot into single user mode, it gives me a bunch of "...."has no kernal dependency lines, then a 'still waiting for root device' line, and repeats that.
    Something to the effect before the 'still waiting for root device' is "Waiting on <dict ID="0"><key>IOProvider-Class</key><string ID="1">IOResouces</string><key>IOResouceMatch></key><string ID="2">boot-uuid-media</string></dict>"
    Any help please?

    Nevermind...I found out that the hard drive was bad...still puzzles me why it wouldn't boot from CD though, as I thought they all should even if no drive is present.

  • How to mount USB & CDROM drives from single user mode - Solaris boot disk?

    Hi All,
    I need to carry out ufsrestore on a single newly replaced system disk (no redundancy / mirroring) from either USB or CDROM drives from the following steps:
    ( i ) GRUB => e, e, cdrom –s, Enter, b (boot from Solaris 10 x86 media).
    ( ii ) Choose menu 1 for Install Solaris Interactive Mode to reach single user mode.Below are the commands that I have tried in single user mode without success:
    mount –r –F pcfs /dev/dsk/c1t0d0p0 /cdrom (after unmount Solaris CD)
      mount: /dev/dsk/c1t0d0p0 is not a DOS filesystem.
    svcadm –v enable smserver
      svcadm: Pattern ‘smserver’ doesn’t match any instances
    svcadm enable autofs
      svcadm: Pattern ‘autofs’ doesn’t match any instances
    devfsadm
      devfsadm: mkdir failed for /dev 0s1ed: Read-only file system
    mkdir /mnt
      mkdir: Failed to make directory “/mnt”; Read-only file systemPart of the problem is due to the current READ ONLY filesystems which does not allow the creation of mount point such as /mnt.
    I have been able to create both / root (/dev/dsk/c1t0d0s0) and /export/home (/dev/dsk/c1t0d0s0) filesystems with newfs that are awaiting for restore using ufsrestore.
    The only option I am left with is to attach a secondary disk to install Solaris 10 on either of them before bring the system to multi-user mode so that service such as volmgt, autofs, volfs are available to access USB & CDROM drives.
    Any suggestion on how to resolve this issue?
    Many thanks,
    Jack

    Hi JKGN,
    Is the directory a located under the root filesystem. ie /a? Are there any other mount point for say USB drive as well? I am not in a position to try it out right now but will get back
    to you soon on whether /a exist or not.
    Btw, the last thing I managed to do on this system at the time was added a secondary 1TB internal disk with the intention to restore both / and /export/home data onto this disk while
    making use of all the disk device management services such as the following services only available in a fully installed Solaris system (both single & multi-user modes) installed on the
    primary disk:
    # svcs smserver
    STATE          STIME    FMRI
    online         Jun_08   svc:/network/rpc/smserver:default
    # svcs autofs
    STATE          STIME    FMRI
    online         Jun_08   svc:/system/filesystem/autofs:default
    # devfsadm
    # iostat -En
    c1t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
    Vendor: ATA      Product: SAMSUNG HD321KJ  Revision: 0-11 Serial No: 
    Size: 320.07GB <320072932864 bytes>
    Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
    Illegal Request: 41 Predictive Failure Analysis: 0
    c0t0d0           Soft Errors: 0 Hard Errors: 5 Transport Errors: 0
    Vendor: PHILIPS  Product: DVD+-RW DVD8801  Revision: AD21 Serial 
    Size: 17.54GB <17538875392 bytes>
    Media Error: 0 Device Not Ready: 5 No Device: 0 Recoverable: 0
    Illegal Request: 10 Predictive Failure Analysis: 0
    c2t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
    Vendor: JetFlash Product: Transcend 16GB   Revision: 1100 Serial No: 
    Size: 0.00GB <0 bytes>
    Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
    Illegal Request: 7 Predictive Failure Analysis: 0
    # rmformat
    Looking for devices...
         1. Volmgt Node: /vol/dev/aliases/cdrom0
            Logical Node: /dev/rdsk/c0t0d0s2
            Physical Node: /pci@0,0/pci-ide@1f,1/ide@0/sd@0,0
            Connected Device: PHILIPS  DVD+-RW DVD8801  AD21
            Device Type: DVD Reader/WriterHowever, I was disappointed that "iostat -En" has not found the secondary disk (1 TB) even though it was available earlier, for Solaris installation as the only disk on the same system.
    As a result, I am left with no option but the need to rebuild this system with only a single primary disk while in single user mode. However, the single user mode that I am in is the
    one from Solaris installation disk with restrictive (_cannot create folder for mount point or running disk management utilities_) capability such as those services just covered, compared to one from a completed Solaris installation system with full access to all filesystems and utilities / commands in general.
    I would very much value your assistance on how to mount both CD & USB in this restrictive limited Read Only OS (assume that it is running from memory) in order to get complete access to
    the blank primary disk so that full restore with ufsrestore could take place.
    Thanks in advance,
    Jack
    Edited by: 797805 on 9/06/2012 04:15

  • Mounting a usb hard drive in single user mode

    I've gotten as far as connecting the hard drive at boot, but I don't know how to figure out which dev is the hard drive, and which arguments to use with the mount command. I can't do much when I login, and I'm trying to cp files from my hard drive to my external hard drive through single user mode.
    Any help is greatly appreciated. Thanks.

    Hi leung wai,
       I wouldn't mind knowing the answer myself. I think the problem with doing it in the manner you attempted is that the device tree hasn't been created yet so the mount command is certainly not going to work. I assume that the answer is to start up enough of the system to have the device tree created. Unfortunately, I don't know where in the startup process that occurs. You could try the following command after making the boot volume writable:
    /usr/libexec/registermach_bootstrapservers /etc/mach_init.d
    Then check to see if the /dev virtual filesystem has been created. Of course it wouldn't surprise me if that didn't also mount your disks. If not, try the following:
    /sbin/SystemStarter
    It should have been created after that because at that point almost the whole system has started.
    Gary
    ~~~~
       You've been telling me to relax all the way here, and
       now you're telling me just to be myself?
             -- The Return of the Secaucus Seven

  • Mount an external hard drive in single user mode

    Do any know how to mount an external hard drive in single user mode:
    I've issue the following command:
    /sbin/mount -uw /
    mkdir /Volumes/ex1
    /sbin/mount_hfs /dev/disk2s3 /Volumes/ex1
    (I've checked my external hard drive using df -k showing the device is disk2s3)
    Result:
    Permission denied

    Hi leung wai,
       I wouldn't mind knowing the answer myself. I think the problem with doing it in the manner you attempted is that the device tree hasn't been created yet so the mount command is certainly not going to work. I assume that the answer is to start up enough of the system to have the device tree created. Unfortunately, I don't know where in the startup process that occurs. You could try the following command after making the boot volume writable:
    /usr/libexec/registermach_bootstrapservers /etc/mach_init.d
    Then check to see if the /dev virtual filesystem has been created. Of course it wouldn't surprise me if that didn't also mount your disks. If not, try the following:
    /sbin/SystemStarter
    It should have been created after that because at that point almost the whole system has started.
    Gary
    ~~~~
       You've been telling me to relax all the way here, and
       now you're telling me just to be myself?
             -- The Return of the Secaucus Seven

  • Mount external Hard drive in Single user mode

    Do any know how to mount an external hard drive in single user mode:
    I've issue the following command:
    /sbin/mount -uw /
    mkdir /Volumes/ex1
    /sbin/mount_hfs /dev/disk2s3 /Volumes/ex1
    (I've checked my external hard drive using df -k showing the device is disk2s3)
    Result:
    Permission denied

    I seem to remember the "Permission denied" or "Device busy" coming up in some situations but not others when attempting to mount drives at this early stage in "single user" mode...
    It might be worth trying to run:<pre>sh /etc/rc</pre>This is actually present among the "Tiger" messages in "Single User" mode, as the procedure to continue booting but remaining in "single user" mode. Indeed, it seems to start up the usual "services" like starting disk arbitration (so you can eg. use 'diskutil' to repair permissions, or loading "NetInfo" so you don't need to work in '-raw' mode - in the past, people had posted complicated procedures for doing these things manually.
    After running the 'rc' script, try creating your mount point and and running 'mount_hfs' as usual...

  • Mounting external drive while in Single-User mode

    Last night, a friend of mine's hard drive was failing in his Macbook (in San Diego, I'm in Colorado). Booting into normal mode would cause a lot of errors. He booted into single-user mode and could not figure out how to mount his firewire drive. I booted into single-user mode on my Macbook and hooked up my USB drive and did an 'ls -ltr /dev' to see if the device showed up. Since it did not show up on the listing of /dev, there's no obvious way to mount it. I can't seem to find any legitimate posting out there nor here. Is there an answer to this problem?
    Thanks,
    Dave

    Perform the mount command listed here, using a different mount tool if it's not a Mac formatted drive.
    (36291)

  • Mounting external drives in single-user mode?

    Sigh. What were the odds of the HD on my month-old MacBook Pro and the HD on my somewhat older one (which was filling in for the moment as a backup) failing on the same night? Pretty low, I'm guessing, but that's what has happened. The Genius Bar has confirmed that the new drive is completely toast, and Apple is replacing it now, but of course they can't salvage the data. As for the old drive, while it won't boot and isn't visible to other machines in target disk mode, I am able to mount it in single-user mode and even view text files. What I can't seem to do is mount my external FireWire/USB2 drive so that I can try actually copying the files off.
    I've re-read the man page for "mount" in hopes of discovering the correct incantation, but so far it has eluded me. I've been trying things like "/sbin/mount -w /dev/disk1 /Volumes" and "/sbin/mount -w /dev/disk1 /Volumes/rescue", which return "Permission denied" and "No such file or directory" respectively...not sure that's the right device, but finding an acceptable mount point seems to be an issue regardless. Hoping someone can point me in the right direction, and thanks for reading.

    Thanks, macbig...no joy yet, but definitely a helpful link.
    I've confirmed via System Profiler on laptop #3 that my external USB drive is formatted as MS-DOS FAT32, so mount_msdos seems like the right utility to use. (The drive shows up there as /dev/disk1s1.) Meanwhile, "ls /dev/disk*" on the problem machine returns the following:
    /dev/disk0 /dev/disk0s1 /dev/disk0s2 /dev/disk1 /dev/disk1s1 /dev/disk1s2 /dev/disk1s3 /dev/disk2 /dev/disk2s1
    I've created /Volumes/rescue as a mount point and tried most of those devices with "/sbin/mount_msdos [device] /Volumes/rescue", with the following results:
    /dev/disk1:
    mount_msdos: Unsupported sector size (0)
    /dev/disk1s1:
    mount_msdos: Unsupported sector size (1)
    /dev/disk1s2:
    mount_msdos: /dev/disk1s2: Bad file descriptor
    /dev/disk1s3:
    mount_msdos: Unsupported sector size (0)
    /dev/disk2:
    mount_msdos: Unsupported sector size (64543)
    /dev/disk2s1:
    kextload: cannot resolve dependencies for kernel extension /System/Library/Extensions/msdosfs.kext
    error loading extension /System/Library/Extensions/msdosfs.kext
    mount_msdos: msdos filesystem is not available
    Based on this, I'm guessing that disk2s1 is the device I want. Unfortunately, when I try to poke around in /System/Library/Extensions, I'm getting I/O errors...gah. I have a bad feeling about this.

Maybe you are looking for