In the recent past I asked about fixing a RAID array on a NAS drive and was kindly given some advice by Mark Rogers. Plainly a sensible option and which was included in the advice, was to have a backup. So yesterday I went out and bought a USB3 1 TB external drive along with a new USB 3 card. I've bunged the card in and got all sorts of errors, something about 'ring error' which from my brief searches relates to the kernel being too old. I'll attend to that later as I can still use the new drive on a USB 2 port. Granted it will take longer but I can live with that.
My question is how should I safely copy everything off my NAS box on to the new drive? Should I just use cp or rsync? The emphasis here is 'safely' as I want to make sure I copy everything off the NAS and back again in case that goes 'nipple north'.
If it helps, here's what I want to copy from - //storage_server/Laptop_Share on /media/Laptop_Share type cifs (rw,noexec,nosuid,nodev) //storage_server/FTP_RAID_C on /media/linux_Share type cifs (rw,noexec,nosuid,nodev) //storage_server/Epox_Share on /media/Epox_Share type cifs (rw,noexec,nosuid,nodev) //storage_server/Media_Share on /media/Media_Share type cifs (rw,noexec,nosuid,nodev)
In the past I would simply have cp'd everything off but having watched the recent discussions on rsync, it has prompted me to ask this question here.
Any help appreciated.
On 24 February 2013 18:21, Chris Walker cdw_alug@the-walker-household.co.uk wrote:
In the past I would simply have cp'd everything off but having watched the recent discussions on rsync, it has prompted me to ask this question here.
If what you're looking for is a simple (accurate) copy of source to destination then absolutely rsync is the way to go. Unlike cp, you can re-run it to pick up changes that happened after your last run. That said, for the initial copy there's no real difference between cp and rsync (different methods but same result). Using whichever gives you the most confidence is what matters to some extent - after all, an exact copy is an exact copy! If you have plenty of time, then you can use tools like md5sum to confirm that both drives have the exact same data (although for something like this I would "trust" rsync and not worry about a subsequent checksum).
Bottom line: cp and rsync will reliably copy from A to B, with permissions and other attributes intact (with the right commandline options of-course). rsync will compare A and B and only copy changes, making the process vastly faster on subsequent runs; rsync can also handle A or B being remote (ie over a network), and will compress the traffic between A&B if required to reduce bandwidth (again with the right options set). Furthermore (with the right options set), rsync can also delete files from B that have been deleted from A to ensure A & B completely match (cp will only add/replace but not remove files). All of this means that for any bulk copy operations, rsync is way more flexible than cp, but because of this it can be harder to use (although in simple cases the two are pretty similar: compare "cp -a ~/A ~/B" vs "rsync -a ~/A ~/B" as two ways to copy A to B). The key is to get the options right in both cases, and because cp can do less there are fewer options to have to worry about!