External USB drive not detected in Single User Mode

gerardkcohen

Registered
I have a Macbook Air somehow has lost/ damaged the user DB as none of the none of the user accounts are available.

In single user mode, I have checked the users in the password file and my username is not listed.

I tried changing the root password but I was unable to logon

I tried deleting the .AppleSetupDone file, but it always hangs on trying to configure computer.

I tried adding a user but im getting errors using dscl.

My last resort is to just copy the user files using SUM and then reinstall. My problem is that I am unable to detect my usb drive in SUM.

It does not show up when I do ls /dev/disk* but I do get a message when I disconnect the usb drive.

I do not have an OS disk, nor do I have a superdrive with me.

I just want to mount the USB drive and copy the files in SUM.


Additional info:
Macbook Air 10.5.8
External drive: Maxtor One Touch II 250GB

Any help would be greatly appreciated.
 
Last edited:
FYI. I figured it out.

I spent almost 12 hours trying to figure this out. Im sure an experienced mac user could have done it quicker, but I dont use macs nor do I have any experience troubleshooting. I was able to rely on LOTS of google, and my experience as an MCSE.

For anyone else that needs to know how I did it, I hope this is helpful for you.

First, I installed macdrive (http://www.mediafour.com/macdrive) on my windows machine to format my usb drive in the hfs format.

Then booting up in single user mode (hold down command and s while powering up until the terminal starts) i ran the following commands:

/sbin/fsck -fy
/sbin/mount -uw /

Because I was not seeing the usb drive when running ls /dev/disk* I had to run the following:

launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist

I ran into some error messages about diskarb, but after about 20 minutes they went away. After that was done, I was able to view the usb drive by doing the ls /dev/disk* again. The drive was indeed the last drive listed.

Next I created a volume:

mkdir /volumes/usb

Then mounted the drive to the volume i created:

/sbin/mount_hfs /dev/[disk#] /volumes/usb

I needed to specify the file system to get that to work properly.

Then I ran the following to copy all the files in the user dir to the usb drive.

for dir in /Users/[username]/*; do cp -R -v -X "$dir" /volumes/usb; done;

I used that line because of the fact that cp did not like files with spaces or any other special characters in them.

I used the -R option so that all files and directories were copied, -v to see the progress, and -X so that I wouldnt run into permission problems. Read manual on cp to get more info, ie run: man cp

Im sure there are better ways, maybe the options or order of which I did things was not the best way, but I did what I could and got the job done.

I hope this saves someone some trouble.
 
1) Attach USB external drive that already has HFS partition
2) Boot into single user mode: Command – S (Soon as you get command prompt, run the commands below)
3) /sbin/fsck –fy (this is to check the filesystem and repair when necessary)
4) /sbin/mount –uw / (mount root folder)
5) Mkdir /Volumes/usb (create folder to restore data to)
6) ls dev/disk* (find your USB drive partition usually the last one)
7) mount –w –t HFS /dev/[disk#] /Volumes/usb (whereas [disk#] is your usb drive. ie – disk2s2)
8 ) cp –R –p /Users/[oun] /Volumes/usb/[oun] (whereas [oun] is the user’s home directory. ie – smith) (when done, run below)
9) Ls –h /Volumes/usb/[oun]/* (verify that data were copied)
10) umount /Volumes/usb (detach USB drive and then disconnect cable)
11) Rebuild the system and complete the procedures accordingly then open terminal window and attach USB drive.
12) Sudo Cp –R /Volumes/[usb drive]/[oun] /Users/[oun] (Restore user’s home directory)
13) Ls –l /Users (verify that user’s home directory exists and uid is present. ie – drwx——+ smith 12345 1054 Feb 9 15:03 longo1 whereas 12345 is the uid)
14) Have the user logon the system to verify home directory is valid.
15) Completed!
 
Back
Top