copy directory tar.gz file from root to external hard disk error

6,465

Do not try to write to a device file (/dev/sdxY) - you should write to the mount point (/media/username/drive_name)

Since your trying to copy as root you should be doing:

cp -av dspace_tar.gz /media/username/external_hdd_name

If you don't know the mount point of the device, first plug it in then do this to get the address:

lsblk -f

The options:

  • -f option provided more information about the filesystems.
  • -a : used when copying archives
  • -v : displays the process in the terminal
Share:
6,465

Related videos on Youtube

user1387755
Author by

user1387755

Updated on September 18, 2022

Comments

  • user1387755
    user1387755 almost 2 years

    I am able to login to root terminal and then create tar zip file by running the command tar -zcvf dspace_tar.gz /home/dspace in a root terminal.

    But I am not able to copy using the command

    cp -av dspace_tar.gz /dev/sdb1
    

    which is my external hard disk.

    I get two errors: stat error and no such file or root directory.

    • George Udosen
      George Udosen over 7 years
      Please you should be doing cp -av dspace_tar.gz /media/username/external_hdd_name
    • George Udosen
      George Udosen over 7 years
      Do sudo lsblk -f to see the address of the device when its plugged in.
    • Zanna
      Zanna over 7 years
      @George I suggest writing an answer here
    • George Udosen
      George Udosen over 7 years
      @Zanna done that.
  • George Udosen
    George Udosen over 7 years
    Only when he is trying to format the HDD should he be doing mkfs -t ext4 /dev/sdb1 doing that will destroy any data he has there
  • anna328p
    anna328p over 7 years
    Bad idea. He has filed in the gas.