Backup files from Terminal in Recovery Mode
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
For new macs using disks with APFS (Apple file system) you can simply do:
diskutil apfs unlock "Macintosh HD"
And then access it by:
ls "/Volumes/Macintosh HD"
When booted to OS X Recovery the root of the Macintosh HD is not /
, it's: /Volumes/Macintosh HD/
To get to your Home directory in Terminal, use:
cd "/Volumes/Macintosh HD/Users/User_Name"
Where User_Name
is the name of your User Account.
From there you can access your directories such as Documents, Desktop, Pictures, etc.
When booting into the Recovery Partition, the Macintosh HD does get mounted automatically and should be listed in /Volumes
. If this is not the case, run Disk Utility (accessible through one of the menus in Recovery Mode) first to check the drive for errors and have them fixed.