rsync is filling up my root folder
I have been using rsync to back up my home folder to another internal disk drive. The backups appear to be working fine. The files and folder structure are being reproduced accurately on the backup drive.
I have, however, today received an error saying file not copied due to lack of space and a notification saying that the root folder has 0 bytes left.
The backup disk is a 2 TB disc and has plenty of space but the root folder is indeed full. It appears that rsync has been making a backup copy of my home folder in /media in my root partition as well as on the backup drive.
The command I have been using is
rsync -auhv --delete --exclude 'Archives' /home/phill /media/phill/Backups
It appears that the destination part of the command
/media/phill/Backups
has caused rsync to make a backup in the root /media folder and on the other drive simultaneously. I’d be grateful if someone could tell me how to make the command point to the other internal backup drive only.
The backup drive would be sda1. My Linux installation is on sdb1 in a 100 GB partition. I have a separate home folder in sdb3. I am running Ubuntu 18.04.4 LTS
The output from df -h is as follows
phill@Phill-PC:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 2.3M 1.6G 1% /run
/dev/sdb1 92G 46G 42G 53% /
tmpfs 7.8G 138M 7.7G 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/loop1 55M 55M 0 100% /snap/core18/1066
/dev/loop2 15M 15M 0 100% /snap/gnome-characters/296
/dev/loop0 43M 43M 0 100% /snap/gtk-common-themes/1313
/dev/loop4 4.2M 4.2M 0 100% /snap/gnome-calculator/406
/dev/loop3 94M 94M 0 100% /snap/core/9066
/dev/loop5 256M 256M 0 100% /snap/gnome-3-34-1804/33
/dev/loop7 161M 161M 0 100% /snap/gnome-3-28-1804/116
/dev/loop10 3.8M 3.8M 0 100% /snap/gnome-system-monitor/100
/dev/loop6 1.0M 1.0M 0 100% /snap/gnome-logs/100
/dev/loop8 2.5M 2.5M 0 100% /snap/gnome-calculator/748
/dev/loop12 63M 63M 0 100% /snap/gtk-common-themes/1506
/dev/loop9 2.3M 2.3M 0 100% /snap/gnome-system-monitor/145
/dev/loop11 150M 150M 0 100% /snap/gnome-3-28-1804/67
/dev/loop13 1.0M 1.0M 0 100% /snap/gnome-logs/61
/dev/loop14 89M 89M 0 100% /snap/core/7270
/dev/loop15 384K 384K 0 100% /snap/gnome-characters/539
/dev/loop16 55M 55M 0 100% /snap/core18/1754
/dev/sdb3 1.7T 652G 914G 42% /home
tmpfs 1.6G 16K 1.6G 1% /run/user/121
tmpfs 1.6G 48K 1.6G 1% /run/user/1000
/dev/sdc1 1.9G 32M 1.7G 2% /media/phill/PNY
/dev/sdd1 3.8G 20M 3.8G 1% /media/phill/4GB
/dev/sda1 1.8T 153G 1.6T 9% /media/phill/Backups1
This is part of my rsync backup bash file. I have had it fill / when not correctly mounted, so I had to add this:
my_mount="/mnt/backup"
# /dev/sdb4 backup_b partition on Z170, became sda4 with new NVMe drive
if grep -qs "$my_mount" /proc/mounts; then
echo "It's mounted."
else
echo "It's not mounted. Trying mount"
mount -t ext4 /dev/sda4 $my_mount
if [ $? -eq 0 ]; then
echo "Mount success!"
else
echo "Something went wrong with the mount..."
exit $?
fi
fi
I have a lot of excludes, so use a file.
Backup your home directory with rsync and skip useless folders &
What files and directories can be excluded from a backup of the home directory?