English 日本語

Move your Mac’s home folder to an external disk.

Hi. I’m Agata.

This time, I needed to move my home folder on my Mac to an external disk, so I’ll write this article instead of a memo on how to do it.
I hope this will be helpful to anyone who is trying to do this.

Formatting the external disk

First, connect the external disk to your Mac.

Once the disk is mounted, reformat it using APFS or similar. At that time, you will also need to set the name of the disk.
In my case, I named it ExternalSSD.

In the beginning, I used “External SSD” with a space between “External” and “SSD”, but some command line tools had trouble handling this space.
Other apps and tools may have the same problem, so it is better not to include the blank space.

External Disk Configuration

Then open the disk’s information from Finder. (Click on the disk’s icon and ⌘+ I)
Uncheck “Ignore ownership on this volume” at the bottom of the Disk Info window that opens.
External disks in their default state are set to ignore ownership so that any user on your Mac can access them, but if you don’t disable this, your home folder will be in full view of everyone else.

Create another administrative account

If the user does not exist on the Mac internal disk, you will not be able to log in if the external disk is inaccessible due to malfunction. To prepare for this, create an administrative account on the internal disk.

This way, if you move your home folder to an external disk and something goes wrong, you can avoid the worst case scenario of not being able to log in to your Mac.

If you already have an account with administrator privileges, you do not need to create another one.

Copy the home folder

Copy the entire home folder to an external disk. You can drag and drop it with the Finder, but if it is large, you will feel sad if you have to start over if something goes wrong during the process.

So this time I tried using rsync, which I am familiar with and can retry.

Setting permissions for Terminal.app

Since the commands will be executed from the terminal, you need to set the permissions on terminal.app.
If you don’t set the permissions, you will get an error message “Operation not permitted (1)” when copying under ~/Library/.
Open “Security & Privacy” in the “System Preferences” and open the “Privacy” tab.
Select “Full Disk Access” in the list on the left, and check “Terminal” in the list on the right.

Run the rsync command

Since the standard MacOS rsync is an old version, I used rsync installed by homebrew.
The version was 3.2.3.

Copy the home folder with a command like the following.
Before executing the command, close all applications except the terminal.

sudo rsync -aHAXNP /Users/agata /Volumes/ExternalSSD/Users/

Each option has the following meaning.

--archive, -a            archive mode; equals -rlptgoD (no -H,-A,-X)
--hard-links, -H         preserve hard links
--acls, -A               preserve ACLs (implies --perms)
--xattrs, -X             preserve extended attributes
--crtimes, -N            preserve create times (newness)
-P                       same as --partial --progress
	--partial                keep partially transferred files
	--progress               show progress during transfer

I’m trying to leave a hard link, but this may be unnecessary. (Would you rather not?).

In my case, I had about 1TB of data, so it took a very long time to run.
I had an external disk with a relatively fast SSD, so it was still good…

After rsync finishes running, check for any errors.
There may be a few errors, but you can ignore them if they are not fatal (such as files that are automatically generated by the application) because there may be things that cannot be copied due to the influence of running applications.

Change home folder settings

After syncing, open “Users and Groups” in the “System Preferences”, select the user whose home folder you copied from the left list, and right-click to open “Advanced Options…”.

In the advanced options, modify the “Home directory” field to the destination folder that you have copied to, and press the “OK” button.

When you are done, restart your Mac to complete the process.

Try logging in as the user you moved and see if it works.