Question: My Ubuntu Linux server has an mdadm array (RAID 5) with four 2TB SATA disks that keeps "loosing" two disks from time to time. Rebooting and re-assembling the arrays has worked out fine up until now.

Hardware is a Dell PowerEdge T20 with an Exsys EX-3400 card that provides four additional SATA ports. Two of the fours disks in the RAID array are connected to the Exsys card, and the remaining two disks are connected to the onboard SATA ports (the remaining onboard SATA ports are in use for other disks). I checked for disk faults using smart utilities, they all seem good.

The disks that are being "lost" from the RAID are the two connected to the add-on SATA controller, so I replaced the add-on card with another one (didn't help, same symptoms). I replaced the SATA cables of the relevant disks (didn't help, same symptoms).

Does anyone have an idea what the source for these issues might be, and what else I could test?

Answer: 
You have these three commands

```
mkdir test_dir test_dir1 test_dir2 test_dir3
touch file1 file2 file3
cp -v file* test_dir*/

```

Assuming no other files or directories in `.` before the example is started, the wildcards in that last line get expanded thus:

```
cp -v file1 file2 file3 test_dir/ test_dir1/ test_dir2/ test_dir3/

```

(You can see this by changing `cp` to `echo cp` and observing the result.) What you didn't tell us is the diagnostic messages produced by `cp -v`, which show what it is trying to do, i.e. copy every item on the command line but the last into the last item, which must therefore be a directory:

```
‘file1’ -> ‘test_dir3/file1’
‘file2’ -> ‘test_dir3/file2’
‘file3’ -> ‘test_dir3/file3’
cp: omitting directory ‘test_dir/’
cp: omitting directory ‘test_dir1/’
cp: omitting directory ‘test_dir2/’

```
Because the `cp` commands works so. If it has more as 2 argument, the last argument must be a directory, and every argument before that will be copied into.

I think you want a `cp` which behaves much more like the windows `copy` command, and yes, there are such tools, although they aren't widely used. Even I had to google for that.

Your actual goal could be easily reached by a simple loop:

```
for i in test_dir*; do cp -v test_file* $i; done

```

It is much more simple as it seems on the first spot. Bash is actually a basic-like programming language, and doing loops or even more complex operations in single-line commands in a unix environment is quite common.