MacOS – Backup files from Terminal in Recovery Mode

data-recoverymacosterminal

I want to transfer files in Recovery Mode https://support.apple.com/en-us/HT201314. I opened Terminal in Recovery Mode and tried to copy files to external hard drive. I use this code

// I used cd .. to get to the topmost folder
cd Volumes // takes me to volumes
ls
cd OS\ X\ Base\ System
ls

The problem is that this creates a loop. Upon cd-ing to OS\ X\ Base\ System it takes me back to the start, namely the / folder that contains Volumes. I want to copy the whole Document directory and Desktop directory. What I am doing wrong?

EDIT>

When I first enter the Terminal, I am in private/var/root/Library, the system created a var folder when figuring out something is missing I guess.

Best Answer

My goal was to copy files to the external hard drive. They are stored in Macintosh HD (I originally thought I will find Macintosh HD in a subfolder of OS X Base System - wrong assumption). There was no Macintosh HD in Volumes folder, because I first needed to unlock it (I use FileVault).

First you need to find the lvUUID of your Macintosh HD. Use this command:

diskutil list // lvUUID

Look for text looking similar to this:

Logical Volume on disk0s2 
4B2EFAAE-C871-4E6D-AB15-2DDE604B97CE // this is lvUUID
Unlocked Encrypted

To unlock use this command:

diskutil cs unlockVolume lvUUID #replace lvUUID by the one shown in the diskutil listing

You will be prompted with password for your user account. After that Macintosh HD will be present in /Volumes/ folder.

All thanks to klanomath for enlightening me. See full Q&A here: No Macintosh HD in Volumes folder