How to: Backup files on a Mac HDD And Restore to Mac Using Linux

I had a friend’s mac stop booting so he told me to backup his mac. These are the steps I took to copy the files from the hard drive, reinstall OS X and restore the files

What you’ll need:

  1. External HDD
  2. Flash Drive 2GB
  3. Mac that wont boot up

Copy Files from Internal HDD to External

  1. Get a copy of ubuntu, put on flash drive  and boot it on the MAC
  2. Format the hard drive to EXT4 for maximum compatibility (meaning all files can be copied)
    1. Note: NTFS/FAT doesn’t allow  some characters like : or or / in the filename and those files wont be copied, so use EXT4 instead to backup the files to.
  3. In the terminal, copy files from the internal hard drive to the mac
    1. sudo cp -r /path/to/macdrives /home/user/newdirectory
    2. e.g. sudo cp -r /media/ubuntu/fromDrive /media/ubuntu/toDrive
    3. Note: you could do path/to/drive/*  so files inside drive are copied

Source: https://superuser.com/questions/600054/how-to-backup-mac-data-using-ubuntu

Change ownership of files on the MAC

  1. Execute the following commands, replace /media with the location of your media

# chown -R user:user /media/toDrive
# chmod -R 775 /media/toDrive

Note: Because we are on a live CD, change the owner to ubuntu:ubuntu 

Source: https://askubuntu.com/questions/858793/this-location-could-not-be-displayed-on-ubuntu-16-10

Reinstall OS X – Steps not in guide, do some googling

Restore Files from Linux to Mac – SCP –This proved to be the best method despite it being slow, make sure both computers are connected through ethernet

  1. Enable Remote Login in macOS Preferences
  2. SCP the files
    1. $ sudo scp -r /path/to/local/directory user@<local-ip-of-computer>:/Users/<username>/Desktop

Source: https://www.howtogeek.com/191116/how-to-share-files-between-windows-mac-and-linux-pcs-on-a-network/

-Methods to restore files that did NOT work

Restore Files by zipping and unzipping- This produced a corrupted zip file and got an “Error 20 – No a Directory” on the mac side 

  1. Compress files into a zip file (this will alleviate problem of invalid characters when transferring files to FAT/NTFS)
  2. Copy zip file to exFAT formatted
    1. This is mountable on the macOS, Linux AND Windows partition
  3. Copy zip file to macOS and extract

Restore Files from Linux to Mac – File Share — This caused too many question/prompts when transferring files and would pause transfer every time

  1. I could not find a way to mount the external HDD in ext4 filesystem to the MAC, even using FUSE or ext4fuse, installed through homebrew So I decided to:
  2. Share the files on the mac using the guide below “Share a Folder on Mac OSX” section
  3. Access it to through the linux
    1. Connect to server “afp://192.168.1.xxx” IP of mac
  4. Copy and paste the files on from the linux computer to the Mac