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.
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
# 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/
# 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/
# 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
# 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
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