0

I have an unusual problem, which is possibly down to me being a novice command line user, but also applies to using the GUI.

The situation is that I have a networked drive mounted at /media/drive/dir using a cifs mount at log-in (via modified fstab, permissions 0777 for both dirs and files) and I want to copy a directory containing several sub-directories with up to 100's of files (3rd-gen sequencing) in each to /home/USER/Desktop/dest. To do this I use:

cp -r /media/drive/dir /home/USER/Desktop/dest

When this runs, cp completes with no error messages, but not all the sub-directories are there, and the sub-sub directories are also sometimes missing. The same command works fine copying files from other locations within the local system, it only seems to happen for the networked drive. This phenomenon also happens when I use the copy/paste command from the GUI. I can individually copy the files/directories, but this is very laborious and time consuming.

I have read many of the other threads on here and cannot find any that are comparable. Any help appreciated.

1
  • I'll delete my comment then. I'll also delete this one in a few moments. Jul 24, 2019 at 20:29

2 Answers 2

1

Most probably the reason is that the source directory contains symbolic links.

From https://www.gnu.org/software/coreutils/manual/html_node/cp-invocation.html#cp-invocation:

When copying from a symbolic link, cp normally follows the link only when not copying recursively or when --link (-l) is used. This default can be overridden with the --archive (-a), -d, --dereference (-L), --no-dereference (-P), and -H options. If more than one of these options is specified, the last one silently overrides the others.

Add the -L-option to your cp- command:

cp -rL /media/drive/dir /home/USER/Desktop/dest 
1
  • Thanks. Still didn't work. I'll have a closer look at the documentation and contact our server people and see if I can get some clarification from them on the file system and why this doesn't interface with linux well. I can see all the files if I cd into the directories, and ls lists them properly.
    – bob1
    Jul 25, 2019 at 16:08
1

In the hope that this will help someone else out someday:

It turns out it was a degradation of the connection between the computer and the server, and a simple restart of the system and re-mounting the server worked to repair this connection and the files copied correctly with the original command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .