# External USB drive not detected in Single User Mode



## gerardkcohen (Dec 30, 2009)

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.


----------



## gerardkcohen (Dec 31, 2009)

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.


----------



## longoman (Feb 15, 2011)

1) Attach USB external drive that already has HFS partition
2) Boot into single user mode: Command &#8211; S (Soon as you get command prompt, run the commands below)
3) */sbin/fsck &#8211;fy* (this is to check the filesystem and repair when necessary)
4) */sbin/mount &#8211;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 &#8211;w &#8211;t HFS /dev/[disk#] /Volumes/usb* (whereas [disk#] is your usb drive. _ie &#8211; disk2s2_)
8 ) *cp &#8211;R &#8211;p /Users/[oun] /Volumes/usb/[oun]* (whereas [oun] is the user&#8217;s home directory. ie &#8211; _smith_) (when done, run below)
9) *Ls &#8211;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 &#8211;R /Volumes/[usb drive]/[oun] /Users/[oun]* (Restore user&#8217;s home directory)
13) *Ls &#8211;l /Users* (verify that user&#8217;s home directory exists and uid is present. _ie &#8211; drwx&#8212;&#8212;+ 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!


----------

