hardlinking takes a lot of space

Posted by mr_schlomo on Super User See other posts from Super User or by mr_schlomo
Published on 2012-01-16T13:05:41Z Indexed on 2012/03/29 5:32 UTC
Read the original article Hit count: 397

Filed under:
|
|

I made an rsync incremental backup script for my server that will copy a MySQL database backup and a specified folder path to a remote server. Here's the code on Github.

Code excerpt from lines 53-57:

############### Create most current hand link

echo "Creating most current hard link on backup server $most_recent_backup_link"
ssh $remote_backup_server rm -rf ${most_recent_backup_link}
ssh $remote_backup_server cp -alv ${remote_backup_folder}/backup-${backup_folder_name}/ ${most_recent_backup_link}

I'm having a problem with creating the most current hard links on the backup server (lines 53-57 in the program). Everything works, and rsync only copies about 1-2MB of data. But the hard link copy process uses about 30MB of data. I get a huge laundry list of files that haven't changed and the only ones that have changed are very small in size. Normally this isn't a problem, but when you backup every hour, the backup should be as small as possible.

For example, the last backup I did, rsync transferred 1.3MB. But the backup directory grew 35MB.

Why are the hard links taking up so much hard drive space?

© Super User or respective owner

Related posts about shell

Related posts about shell-script