devsetup1-10 Exercise 3: Dotfiles, Backups and a Restore Test ============================================================== STEP 1: DOTFILES AND SETUP IN GITEA ----------------------------------- Create an empty repository named dotfiles in the Gitea web page. mkdir -p ~/dotfiles && cd ~/dotfiles mv ~/.bashrc bashrc && ln -s ~/dotfiles/bashrc ~/.bashrc mv ~/.gitconfig gitconfig && ln -s ~/dotfiles/gitconfig ~/.gitconfig cp -r ~/machine-setup . git init -b main git add . git commit -m "Dotfiles and machine setup" git remote add origin http://devserver:3000/YOURNAME/dotfiles.git git push -u origin main Check first: cat ~/dotfiles/gitconfig ~/dotfiles/bashrc for anything secret (tokens, passwords, keys) BEFORE the git add. Remove or move such lines. Check the links: ls -l ~/.bashrc shows -> /home/you/dotfiles/bashrc. STEP 2: FILE BACKUP (PREVIEW, THEN FOR REAL) -------------------------------------------- findmnt /mnt/backup # confirm the backup disk is really mounted rsync -avn --delete --exclude node_modules --exclude .venv --exclude venv --exclude vendor ~/ /mnt/backup/home/ rsync -av --delete --exclude node_modules --exclude .venv --exclude venv --exclude vendor ~/ /mnt/backup/home/ If findmnt prints nothing, the disk is not mounted and rsync would write into an ordinary folder on the main disk. Stop and mount it first. Adjust the destination to your own backup location. STEP 3: GITEA DUMP ------------------ cd /tmp sudo -u git /usr/local/bin/gitea dump --help sudo -u git /usr/local/bin/gitea dump -c /etc/gitea/app.ini ls -lh /tmp/gitea-dump-*.zip Read the --help output first: it says where the archive is written and what options exist in your version. Copy the archive to the backup disk: cp /tmp/gitea-dump-*.zip /mnt/backup/ STEP 4: PROVE THEM ------------------ Restore one file from the rsync copy into a scratch folder and open it: mkdir -p /tmp/restore-test cp /mnt/backup/home/dotfiles/bashrc /tmp/restore-test/ diff /tmp/restore-test/bashrc ~/dotfiles/bashrc && echo identical List the Gitea archive without unpacking it: unzip -l /mnt/backup/gitea-dump-*.zip | head -30 Expect to see the repositories, the database (or its dump) and the configuration inside. If unzip is missing: sudo apt install unzip. Clean up: rm -rf /tmp/restore-test /tmp/gitea-dump-*.zip WHY THIS WORKS AS AN ANSWER --------------------------- The preview guards against the two classic rsync mistakes (wrong path, disk not mounted), and the restore steps turn "I made a backup" into "I have seen that the backup contains what I need". The archive listing is the small version of a full restore; doing a full Gitea restore onto a spare machine once is the real test.