6
1
cp -l
hard links files instead of copying them, saving filesystem space. I need to use rsync instead of cp because of its --exclude
capabilities.
So my question is, how do I get rsync to hard link files instead of copying them? Obviously, this is a local filesystem copy. I've read the docs for rsync's -H
option, but it's unclear to me if this behaves the same way as cp -l
.
It looks like I can get this behavior with
– nnyby – 2018-09-22T18:33:30.043--link-dest=$SOURCE_DIR
: https://slaptijack.com/system-administration/rsync-backups-conserve-disk-space-with-hard-links/ I'm testing this out now.Generally,
rsync
is used for back-up or archive purposes. Why would you want a back-up of file names without their contents? – AFH – 2018-09-22T18:37:56.893@AFH my backup script creates rolling backups of gigabytes of data at many points in time, but most of this data is the same. I save disk space by copying these between time points with
– nnyby – 2018-09-22T18:42:25.930cp -al
. Without using hardlinks, all these different copies of data (if they were real files) wouldn't fit on my 2TB drives. See: https://slaptijack.com/system-administration/rsync-backups-conserve-disk-space-with-hard-links/So you can recover from accidental deletions, thought not overwrites, but you'll never be able to use your back-up to recover from a disc failure or partition loss. I use
cp -au
, which copies only changed files, so the process doesn't take too long, but it does give me an external copy of the latest version of every file for recovery purposes. Of course, to back up Gigabytes of data you need Gigabytes of storage, but if your files are important you need to make that investment. Only unimportant files are not backed up, by definition. – AFH – 2018-09-22T19:02:50.917