1

I have done something stupid and need help:

I have 3 external drives attached to my Mac and in an attempt to make the partition names more meaningful, I renamed them using finder/get info. My user account was located on one of these drives, the other 2 are for TimeMachine. Now of course, I cannot access the user account because I forgot to change the path in System Preferences.

By starting in recovery mode I can see the disks, but Disk Utility does not appear to allow me to change the name. Worse still, I cannot remember what the name of my drive that contains the user account should be. I suspect it can be sorted out from the command line, but my skills do not extend that far.

Any chance someone can provide some guidance on how to rename the partition and how to ensure the user account path matches.

1

The fastest way to solve your problem is probably adjusting the path of your user directory in the yourusername.plist (assuming following current path of your user folder: "/VolumeNameContainingYourUserFolder/Users/yourusername"):

  • Boot to Recovery Mode.

  • Open Terminal.app in the menubar (Utilities -> Terminal)

  • Enter df to get the paths/names of your main system volume and the volume containing your user folder. You may have to move around with cd and check the content of folders with ls if you don't remember the full path of your user folder.

  • Change your working directory to the folder "users" deep inside /private:

    cd /Volumes/NameOfYourMainSystemVolume/private/var/db/dslocal/nodes/Default/users/
    
  • List the content of the folder:

    ls
    
  • Locate your username.plist and convert it to xml:

    plutil -convert xml1 yourusername.plist
    
  • Then modify the file with vim* (please consult online resources how to work with vim first!)

    vim yourusername.plist
    
    • Modify the string

      /Users/yourusername  
      

      or

      /Volumes/WrongVolumeNameContainingYourUserFolder/Users/yourusername
      

      to

      /Volumes/VolumeNameContainingYourUserFolder/Users/yourusername
      

      in the key "home" at line ~90.

    • Save the changes and quit vim.
  • Convert the plist to the original binary format:

    plutil -convert binary1 yourusername.plist
    
  • enter exit and quit Terminal

  • Reboot to your main volume, log-in with your account.

Optional: Enable the root user temporarily. Log-out of your user account and log-in with root.
Make any necessary adjustments like renaming the volume containing your user folder (or other user folders) again and changing the path(s) to the user folder(s) of your main user (other users) in System Preferences accordingly. Log-out and log-in with your common user again. Finally disable root.


*: It's much easier to use nano or pico instead of vim, which has two different modes: command mode and insert mode. While testing the solution in a Recovery HD of a virtual machine, i first tried nano yourusername.plist, then pico yourusername.plist. Both commands gave me an error: Can't find nano/pico. So I decided to use vim, because I was too lazy to find out if nano or pico are present in the Recovery HD at all. You may try nano instead: Use it like an almost common text editor by moving around with the arrow keys and adding or deleting text as usual. After finishing your edit, hit ctrlo to write the changes to disk and ctrlx to exit nano.

  • Someone who is new to Unix should probably use nano instead of vim. – NobodyNada Mar 25 '15 at 17:21
  • @NobodyNada Thanx for your advice. You are right, but i tested it in a VM-Recovery HD and nano yourusername.plist as well.as pico yourusername.plist didn't work because the shell couldn't find nano/pico. So i decided to use vim. I will add a hint. – klanomath Mar 25 '15 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .