I would probably have used tar|tar for this, or rsync.
My experience with using cp to copy 432 million files (39 TB)
11–20 of 267 posts
Re: My experience with using cp to copy 432 million files (39 TB)
#12I would probably have used tar|tar for this, or rsync.
Re: My experience with using cp to copy 432 million files (39 TB)
#13Why?
Re: My experience with using cp to copy 432 million files (39 TB)
#14Re: My experience with using cp to copy 432 million files (39 TB)
#15I feel the pain. I went thru the same hell a few months ago.
Re: My experience with using cp to copy 432 million files (39 TB)
#16> I browsed the net for other peoples' experience with copying many files and quickly decided that cp would do the job nicely.
After 20 years you no longer google how to copy files.
Edit: Reading on he talks about strace and even reading cp's source code which makes it even weirder that he had to google how to do this...
Edit2: Comments! Took only ten downvotes before someone bothered to explain what I was doing wrong, but now there are three almost simultaneously. I guess those make a few good points. I'd still think cp ought to handle just about anything especially given its ubiquitousness and age, but I see the point.
And to clarify: I'm not saying the author is stupid or anything. It's just weird to me that someone with that much experience would google something which on the surface sounds so trivial, even at 40TB.
Re: My experience with using cp to copy 432 million files (39 TB)
#17Re: My experience with using cp to copy 432 million files (39 TB)
#18I would probably have used tar|tar for this, or rsync.
Rsync has similar issues when you are copying hard links. It has to keep a table of all the inodes/filename pairs it sees so it can detect hard links and relink them on the destination. This can be big if you have a ton of hard links (say in a backup situation). Rsync at least acts reasonably idempotent, so you can just run it again if it gets interrupted, which is usually why I use it for large copies. I don't remem…
--partial keep partially transferred files
Is your friend. Esp if you are trying to sync directories with multi GB files. Also if your media is bad or there is a failing piece of network gear along the path --bwlimit=KBPS limit I/O bandwidth; KBytes per second
Can keep things running smoothly. It even works against disks, I have used it where an array would die if one attempted to read from it too quickly.Re: My experience with using cp to copy 432 million files (39 TB)
#19I would probably have used tar|tar for this, or rsync.
For future reference for other folks, the command would look something like this:
cd /old-directory && tar czvflpS - . | tar -C /new-directory -xzvf -
Tarpipes are especially neat because they can work well over ssh (make sure you have ssh configured for passwordless login, any prompt at all will bone the tarpipe): cd /old-directory && tar czvflpS - . | ssh -i /path/to/private-key user@host "tar -C /new-directory -xzvf -"
...but tarpipe-over-ssh is not very fast. I have a note that says, "36 hours for 245G over a reasonable network" (probably 100Mb).Disk-to-disk SATA or SAS without ssh in between would be significantly faster.