0

Trying to drag and drop a file from downloads folder to a sandisk flash drive. When I drag and drop the file it keeps jumping back to the downloads folder.

0

Maybe you don't have permissions to write on the external drive or it is a file system which cannot be read.

To find out if that's the problem, open a terminal and type

lsblk

Followed by "enter". You will get something like the following output:

List of block devices

The size column will probably tell you which device is your flash drive (my usb stick in the picture has 15 GB for example). In the name column, sdx always means the whole device, sdx1 would be the first partition of the device. What you need to write down is the mountpoint of the partition (probably the first and only partition) of your flash drive, it will be something like /media/user/foo - in my screenshot you can see my usb stick mounted at sdc1 with mountpoint /media/.... If no mountpoint is specified, the flash drive is not mounted. In Ubuntu automounting is activated I think by default, so removing the drive and connecting it again should do the trick. Otherwise you need to manually mount it.

Now change to your mountpoint with entering

cd /media/user/foo

(user being the name of your login user), now you should be seeing all your folders which already exist on your flash drive when typing

ls -al

Here, the leftmost column tells you about the file permissions, it is something like

`drwxrwxrwx` or `-r-x------`

d means that this file is a directory, the first rwx are the users permissions, second rwx the group's permissions, third rwx the permissions of everybody else. r = read, w = write, x = execute. If there is a dash (-) instead of the letter itself, a certain permission is not granted. The third and fourth column tells you the user and group the files belong to. This should be your login user & its default group. If this is not the case and the permissions on the files are restricting others from writing (no w at the third triple), then you have your problem.

Now you have several possibilities to fix that:

  1. Copy files with sudo:

    sudo cp /home/user/Downloads/filename /media/user/foo/

    this will give you temporarily root permissions to allow you copying the files. If you want to copy whole directories, you need to copy them recursively with

    sudo cp -R /home/user/Downloads/directory /media/user/foo/

    When prompted for a password, enter your user's login password.

  2. Change the owner & group of your files: you need to go one level higher in the file system with

    cd ..

    Then use the following commands to change user and group of the mountpoint itself:

    sudo chown -R user /media/user/foo

    sudo chgrp -R group /media/user/foo

    -R means recursive, which will modify the user and group of each and every file and directory inside the mountpoint and the mountpoint itself. Your default group has the same name as the user in a default installation of ubuntu, verify that by entering groups in the terminal, the first entry is your default group. Actually, you only need the first line to make it work, the second one with the group is optional.

  3. If nobody is allowed to write to the flashdrive (no w in any of the three sections) you need to adjust the permissions of the files with the command

    sudo chmod u+w filename

    u+w will give user (u) write access (+w) to the file, which you can specify with the relative path name (the path relative to the current directory) or the absolute pathname from the root directory, which will be something like /media/user/foo/filename

If this is not helping, it might be a filesystem issue. You can use gparted to check the type of file system of the flashdrive. Type

`sudo gparted`

and select your device (you know the name from lsblk, it's something like "/dev/sdx"). Be careful with this tool because it can wipe whole disks! The column "filesystem" will be something like ntfs, ext4, fat, ... Please post your filesystem type here that we can help you further.

If you have any questions regarding the whole procedure, don't hesitate to ask :)

-1

Alternate way of doing the same

First create a directory to mount usb

sudo mkdir /media/external

and then

sudo mount -t vfat /dev/sdb1 /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

For more info, refer to this and then try copy operation

cp -r $HOME/Downloads/* /media/external
1
  • Some things to consider: you can't be sure the referred drive is actually /dev/sdb. Also you need to make sure it's unmounted before mounting it. The OP does not want to copy all the content from the Download folder AND there is a unwanted space between cp's - and r. – Eduardo Cola Feb 21 '16 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.