You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not well-versed in that matter, but I had the thought whether hardlinking the files would actually be a better idea.
From what I think I understand, hardlinks are directory entries that point to the same inode already referenced in another directory and/or entry. Inodes have a reference counter, so when deleting a file (path), the corresponding entry is removed and the actual inode is only really deleted if it has no more references. Does this behaviour differ in different file systems?
The only reason to use plain cp or rsync or otherwise creating new inodes with the same content then is to either then modify the independent copy, or when the two locations are on different file systems, right?
In case that all holds true, and if my assumption is correct that we expect the number of cases where /usr/lib/modules/backup/ somehow is a different file system to be negligible, then it would be a much better idea to just hardlink all the files with cp -lr: It doesn't use more space and is much faster because only directory entries are written. Being deleted should not erase the data because of the reference counter and restoring the modules will be the same, just the other way around.
The text was updated successfully, but these errors were encountered:
To add to this report: cp(1) is 10x faster than rsync here.
# time cp -alr "/usr/lib/modules/${KVER}" /usr/lib/modules/backup
cp -alr "/usr/lib/modules/${KVER}" /usr/lib/modules/backup 0,26s user 0,26s system 105% cpu 0,497 total
# time rsync -AHXal --delete-after "/usr/lib/modules/${KVER}" /usr/lib/modules/backup/
rsync -AHXal --delete-after "/usr/lib/modules/${KVER}" 1,17s user 0,80s system 41% cpu 4,731 total
I am not well-versed in that matter, but I had the thought whether hardlinking the files would actually be a better idea.
From what I think I understand, hardlinks are directory entries that point to the same inode already referenced in another directory and/or entry. Inodes have a reference counter, so when deleting a file (path), the corresponding entry is removed and the actual inode is only really deleted if it has no more references. Does this behaviour differ in different file systems?
The only reason to use plain
cp
orrsync
or otherwise creating new inodes with the same content then is to either then modify the independent copy, or when the two locations are on different file systems, right?In case that all holds true, and if my assumption is correct that we expect the number of cases where
/usr/lib/modules/backup/
somehow is a different file system to be negligible, then it would be a much better idea to just hardlink all the files withcp -lr
: It doesn't use more space and is much faster because only directory entries are written. Being deleted should not erase the data because of the reference counter and restoring the modules will be the same, just the other way around.The text was updated successfully, but these errors were encountered: