Why You Need This

When working on a Brev.dev instance, you might run out of space on your main drive. Luckily, there's a larger drive mounted at /ephemeral that we can use. This guide helps you move your home directory there.

Before You Start

Check your drive space:

df -BG | grep -E 'Filesystem|/ephemeral|/$'

You should see something like:

Filesystem      Size   Used  Avail  Use%  Mounted on
/dev/vda1       124G    80G    44G   65%  /           # Your full drive
/dev/vdb       1007G     1G   956G    1%  /ephemeral  # Your target drive

Moving Your Home Directory (Step by Step)

1. Backup Your Files to the New Location

# Create your new home directory
sudo mkdir -p /ephemeral/home/ubuntu

# Copy everything (including hidden files) and keep permissions
sudo cp -av /home/. /ephemeral/home/

2. Make Sure Everything Copied Correctly

# The sizes should match
du -hs /home
du -hs /ephemeral/home

# Compare the files - you should see the same files in both places
ls -la /home/ubuntu/
ls -la /ephemeral/home/ubuntu/

3. Tell the System About Your New Home

# Edit the user settings file
sudo nano /etc/passwd

# Find the line that starts with 'ubuntu' (should be at the bottom)
# Change it to use your new home directory:
ubuntu:x:1000:1000::/ephemeral/home/ubuntu:/usr/bin/zsh

4. Fix Your Shell's Config (Very Important!)

# Edit your shell config in the NEW location
nano /ephemeral/home/ubuntu/.zshrc

# Find the login section (usually at the bottom) and update it to:
if [[ -o login ]]; then
  cd $HOME/verb-workspace
fi

5. Safety Step: Copy Config Files Back

This helps if anything tries to read from the old location:

sudo cp -v $HOME/.zshrc /home/ubuntu/.zshrc
sudo cp -v $HOME/.bashrc /home/ubuntu/.bashrc

6. Test That Everything Works