Copy file to External Hard Disk

40,338

Solution 1

Using cp -b will make a backup of the destination files, i.e. where you are copying to. I do not think you are trying to do this?

The most common use is by using -R, which allows a recursive copy of the source to the destination. Perhaps this would be more appropriate?

You might also consider using rsync (i.e. rsync -avz $SRC $DST --delete), which would allow you to perform smaller backups each time, i.e. it will only transfer what changed`

It may help if you provided details on the external disk, i.e. what filesystem it is using, etc.

Solution 2

From your description I get the feeling that there is something wrong with how or where the system has mounted the external disk.

Please note that it is not recommended to mount storage devices to folders that are not empty, so make sure of that (detach drive, check if folder is empty and if not empty it, then reattach drive) If this does not solve your problem, try the following procedure:

Please run "mount -l" (that's lowercase L) on a terminal. This will print a list of all mounted partitions. Look for your external disk name.

If you are not sure about the name do the following:

  1. Shut down the computer (to unmount all filesystems)
  2. Disconnect the external drive and reboot your computer
  3. When boot sequence completes, open a terminal
  4. Now reconnect your external drive, wait a couple of seconds and type "dmesg" on the terminal. This will produce a long list of messages but you are interested in the last 10 or so. Look for something like :

[some_numbers_here] sd more_numbers [sdx] Some_message

The x in sdx can be a, b, c, etc depending on the number of drives you have installed in your system. If you have only 1 (sda), then the external drive will be sdb. If you have two internal drives (sda, sdb) then the external drive will be sdc and so on.

A note here: These are physical drives and NOT partitions. Partitions are designated by a number being appended to the physical drive name,like sda1, sda2, etc

  1. Now that you know the drive name type "mount -l" on your terminal and look for the line that describes where your external disk is mounted. If you have not mounted any other storage device after connecting your external drive it will be the last line displayed. eg.

    /dev/sdb1 on /media/folder_name type fuseblk (rw,nosuid,nodev, ...

This folder_name should be the destination of your copy command.

Share:
40,338
shou
Author by

shou

Software engineer, security researcher, Open-Source & Free Internet Supporter, Java developer, Linux fans. PGP: 0x745F033D

Updated on September 18, 2022

Comments

  • shou
    shou almost 2 years

    My UBUNTU (desktop part) does not boot completely because of low disk space; I logged in to terminal using my username and password, try to copy some file from /home/UserName/Desktop to my external hard disk by /media/HD-LBU3 address.

    I tried this command:

    sudo cp -b /home/UserName/Desktop/APLC* /media/HD-LBU3
    

    this command does every thing correct but when I go to /media/HD-LBU3 and do ls, terminal just shows what I copied and does not show other files and folders.

    When I go to Windows and open External Hard Disk, Windows does not show what I copied from UBUNTU Terminal.

    Is it necessary to do write command or some thing like this after cp?

    I think

    sudo cp -b /home/UserName/Desktop/APLC* /media/HD-LBU3
    

    does not copy even when it shows my files in terminal.