LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cant copy files from Gentoo server to USB drive. (https://www.linuxquestions.org/questions/linux-newbie-8/cant-copy-files-from-gentoo-server-to-usb-drive-4175602729/)

Chrisroot 03-28-2017 03:01 PM

Cant copy files from Gentoo server to USB drive.
 
Hello Everyone,

My perdicament at the moment is that I am unable to copy a set of files from my Gentoo server to a USB drive. My path is
cp -r /opt/biweb/app/ /dev/sdc/. End result will say that /dev/sdc/ is not a directory. But it is.

Rickkkk 03-28-2017 03:34 PM

Quote:

Originally Posted by Chrisroot (Post 5689368)
Hello Everyone,

My perdicament at the moment is that I am unable to copy a set of files from my Gentoo server to a USB drive. My path is
cp -r /opt/biweb/app/ /dev/sdc/. End result will say that /dev/sdc/ is not a directory. But it is.

Hi Chrisroot,

Actually /dev/sdc is not a *normal* directory. Stuff under /dev represents virtual devices to which you can mount file systems.

List the ouptut of lsblk -fs to see where your USB drive is mounted and copy the files to that mount point. Post the output of the command if you would like us to help you with that.

Cheers.

Chrisroot 03-28-2017 03:43 PM

Thanks for the help.

Command lsblk -fs, " command not found".

rtmistler 03-28-2017 03:45 PM

Likely the destination would be /dev/sdc1

Issuing the mount command will show you what drives are mounted. If this has been auto-mounted, then I'd just try to see if sdc1 is there.

Chrisroot 03-28-2017 03:56 PM

Alright I tried that command- cp -r /opt/biweb/app/ /dev/sdc1/ and the output was "cannot overwrite non-directory '/dev/sdc' with directory /opt/biweb/app/

rtmistler 03-28-2017 03:59 PM

Firstly you should see how it is mounted, using the mount command. Because /dev/sdc1 may be mounted as /media/8fabcdef455461 .... and so forth, or it may be /media/mydisk if you gave the file system a name.

If you wish to copy files from under that source directory, I think the syntax is ok, but you may wish to end that with a dot, as in /opt/biweb/app/.

Rickkkk 03-28-2017 04:01 PM

Quote:

Originally Posted by Chrisroot (Post 5689413)
Alright I tried that command- cp -r /opt/biweb/app/ /dev/sdc1/ and the output was "cannot overwrite non-directory '/dev/sdc' with directory /opt/biweb/app/

... odd about lsblk not being there ... Could you post the ouput of the findmnt command or the mount command as suggested by rtmistler ?

designator 03-28-2017 04:02 PM

Try this:
Code:

mkdir /tmp/mydisk
mount /dev/sdc1 /tmp/mydisk
cp -rv /opt/biweb/app/ /tmp/mydisk/

That mounts your disk under /tmp/mydisk which is a regular directory you can then use to copy files to.

If any of these give you errors, post those here before running the next command.

Also, to view what you need to mount, run
Code:

/sbin/fdisk -l

Chrisroot 03-28-2017 04:07 PM

Alright i tried, mkdir /tmp/mydisk- and the output was "No space left on device." This may be why im having trouble.

designator 03-28-2017 04:09 PM

Quote:

Originally Posted by Chrisroot (Post 5689434)
Alright i tried, mkdir /tmp/mydisk- and the output was "No space left on device." This may be why im having trouble.

What's the output of
Code:

fdisk -l
and

Code:

df --si

Chrisroot 03-28-2017 04:17 PM

fdisk -l

Device Boot Start End Blocks ID System
/dev/sdb1 1 8924 71681998 83 Linux

Disk /dev/sdc 16.0 GB

Device boot Start End Blocks ID System
/dev/sdc1 1 1947 15632384 c

Chrisroot 03-28-2017 04:21 PM

fdisk -l



device boot start end blocks ID system
/dev/sdb1 1 8924 71681998 83 Linux



disk dev/sdc 16.0 GB


device boot start end blocks ID system
/dev/sdc1 1 1947 15632384 c W95 FA32 LBA

The lower potrion is the usb drive

Rickkkk 03-28-2017 04:27 PM

Quote:

Originally Posted by Chrisroot (Post 5689439)
fdisk -l

Device Boot Start End Blocks ID System
/dev/sdb1 1 8924 71681998 83 Linux

Disk /dev/sdc 16.0 GB

Device boot Start End Blocks ID System
/dev/sdc1 1 1947 15632384 c

OK .. we're just missing the mount point. Often removable drives are mounted somewhere under /media ... Have you tried the findmnt command ? Post results ...

Chrisroot 03-28-2017 04:39 PM

ok, mkdir /media/usb-drive, cannot create directory, No such file or directory

Rickkkk 03-28-2017 04:45 PM

Quote:

Originally Posted by Chrisroot (Post 5689450)
ok, mkdir /media/usb-drive, cannot create directory, No such file or directory

Hi Chrisroot - You don't have permission to create subdirectories in /media yourself unless you make some changes. We won't need to do that. Let's start by seeing if it is already mounted. Try the findmnt command I mentioned earlier. You can reduce the output by specifying the block device:

findmnt /dev/sdc1


All times are GMT -5. The time now is 05:21 PM.