0

I have a very old server that stores 16Tb of data. It is running FreeNAS (freebsd). Network cards are physically damaged and the server is on its last breath.

I have 2 8TB NTFS external hard drives. I'm trying to copy all those files into hdd1, and whatever won't fit on it into hdd2. Hard drives are mounted into /mnt/hdd1 and /mnt/hdd2

I have just enough space and incredible complicated file structure I can't just copy couple folders onto one and everything else on another drive. I would need some script to do that. Any suggestions?

Again, it's just freebsd with no UI

0

Try this:

  1. Install rsync
  2. Run the following script
    cd /path/to/data
    rsync --recursive --relative . /mnt/hd1 || (
        find . | sort > /tmp/source.lst
        cd /mnt/hd1
        find . | sort > /tmp/hd1.lst
        diff -ab /tmp/source.lst /tmp/hd1.lst | tail -n +4 | grep -v ^- > /tmp/copied.lst
        cd /path/to/data
        rsync --recursive --relative --exclude-from=/tmp/copied.lst . /mnt/hd2
    )

If installing rsync is not an option, you can do some tricks with lists of files and copying one by one using while and cp.

| improve this answer | |
  • Wow! Thank you. It does looks exactly what I'm trying to find. rsync is installed on the system so it should be fine. Another problem it can't recognize my harddrives, but I think I'll be able to handle that. – NewRK Apr 21 at 2:47
  • @NewRK, if the answer does look exactly what you're trying to find, please mark the question as answered and upvote it. Thanks. – Alan Rezende Apr 27 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.