4

I connected an external hardrive in my pc. I switch to root. I have mounted the disk successfully! (Yay me!!)

Now I want to copy an entire directory from the external hard drive to my local folder.

So I did this:

cp /mnt/external/directory_to_be_copied /home/danai/destination_folder

It hasn't come up with an error. But as soon as I hit enter at the next line there is this _ underscore blinking. And it's been at least 5 minutes now.

So is the cause that the directory I'm trying to copy is too large or is there something wrong??

4
  • wait a bit longer...
    – Zanna
    Oct 7, 2016 at 6:55
  • @Zanna I actually stopped the process with ctrl + c , switched to destonation directory and saw that some copying was made, so I guess I am gonna zip it first. Thanks a lot for taking the time though!! Oct 7, 2016 at 7:01
  • @DanaeVogiatzi: Compressing the data will not make the copy process faster but most likely slower. Just think of this: The amount of data to read and write stays the same but in addition you need to compress and decompress it. Oct 7, 2016 at 11:32
  • This is why rsync is preferable for large scale copying: rsync -a --info-progress2 source/ target
    – muru
    Jan 6, 2017 at 6:01

1 Answer 1

7

When you run into this kind of thing (which happens from time to time) there are a few things you could do.

First, you need a new prompt. If you are using a graphical user interface, this should be as easy as opening a new terminal window. If you are not, you should be able to switch to another tty by using Ctrl+Alt+F2 for example. Another alternative is to pause the current command using Ctrl+z. You can check what jobs you have paused using the command jobs and let the program run again by using, for example bg 1, where bg stands for background.

Once you have a prompt, and the program you think takes too much time is still executing, you can start doing some investigations. One thing to look at is whether the destination is actually being filled:

ls /home/danai/destination_folder

Run the command a few times. Does the output change? If so, you are fine. If not, we need to check further.

Check if your drive is filling up:

df

Run the command a few times - or put a watch on it:

watch df

Does the output change? Is there a drive (containing your home directory) filling up? If so, the command is running, and is working, and is copying something.

Have a look at what you are copying:

du --summarize -h /mnt/external/directory_to_be_copied

This will tell you, approximately, the size of the directory you are copying. This could give you a hint about how much time it will take.

If all this fails, the source might not really be a directory, but rather some kind of mean device filling up your file system. There are such devices. If you watch df you can see if a file system is filling up. If so, you probably want to abort.

Go back to the terminal or tty you used to start the cp (probably tty1 at Ctrl+Alt+F1, if you didn't already change it) or put the command back in the foreground using fg 1 (or whatever number your job had, but probably 1), and abort it with Ctrl+C.

As a side note - when you copy directories, you probably want to use cp -r to copy any subdirectories as well.

1
  • 1
    NIce! Some clear and useful troubleshooting tips. Jan 5, 2017 at 22:19

You must log in to answer this question.

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