Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 12TB enclosure that's filled with data (ext3). I'd like to make a copy of it, spanned across individual 3TB disks, each of which is readable on its own (no RAID or bonding). Ideally, I'd like this process to spit out some index of which files are on which disk, but that's not strictly necessary. The end result must be readable files on the disk in the original directory structure, not an archive file. Splitting directories (duplicating the directory structure) across volumes is fine.

The 3TB disks are not all mounted at the same time (and not able to be), so I need something that will let me pause the copying to switch disks. I strongly prefer a solution that doesn't require me to figure out which files go on which disk or keep track of what's been copied.

Is there an existing package that will do this?

share|improve this question
Just to understand it better: you're looking to split the directory tree into 3 parts, each with a certain size. And the smaller structures have to be fully readable? You know it may never 'fully' fill up without heavily mixing small and big files from different parts in the structure? – Joris Sep 8 '11 at 17:52
With such requirements, please specify at least the operating system – Joris Sep 8 '11 at 17:53
Do you have at least 3TB of free space available somewhere for a big temporary file? – Zoredache Sep 8 '11 at 18:01
This is actually provably computationally hard if your 12T is really full and you've only got 4 3TB drives. Why? This is the bin packing problem rephrased. Welcome to NP-Hard :) Now, if you've got ceil(11/9 * 4 + 1) (aka, 6) drives on hand, it's easy. – Bill Weiss Sep 9 '11 at 1:38
The individual files are sufficiently small (a few MB) that packing should not be a problem. If a few megs per drive are wasted, that's fine. :) – fields Sep 9 '11 at 16:37
up vote 1 down vote accepted

I don't know of an existing package that will do this but here is a completely untested no-error-checking script that may work:




echo "$DISK_ID" > $DST/disk_id

cd $SRC
find . -type f | while read FILE; do

    FILE_SIZE=`stat -c '%a' "$FILE"`
    FREE_DST=`stat -c '%a' "$DST"`

    if [ $FREE_DST -lt $FILE_SIZE ]; then

            while [ $FREE_DST -lt $FILE_SIZE ]; do
                    read -p "Please mount a new disk at $DST and hit enter:"
                    FREE_DST=`stat -c '%a' "$DST"`

            echo "$DISK_ID" > $DST/disk_id

    DST_DIR=`dirname "$FILE"`
    [ -d "$DST_DIR" ] || mkdir -p "$DST_DIR"

    cp -p "$FILE" "$DST_DIR"

    echo "$DISK_ID $FILE" >> $IDX
share|improve this answer
love it! still a little risky, i would make sure that everything gets copied by looking at the combined used space on all 3 drives compared to the original – Silverfire Sep 9 '11 at 0:59
I was considering writing a ruby script to do it. This is pretty close. – fields Sep 9 '11 at 16:58

It's probably out of the scope you are looking for, but the free version of Unraid would do this. You could just assign the 3 drives as data with no parity drive. Set high water to "fill up" and set split levels to whatever meets your needs.

share|improve this answer

rsync anyone? make a few folders, one for each drive, move data that will occupy one drive, then just do a check with rsync, not actually move the data.

check man page

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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