LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Usb drive, how to locate it, how to move folder from Usb drive to usr directory (http://www.linuxquestions.org/questions/linux-newbie-8/usb-drive-how-to-locate-it-how-to-move-folder-from-usb-drive-to-usr-directory-792145/)

eeguy02 02-28-2010 12:41 PM

Usb drive, how to locate it, how to move folder from Usb drive to usr directory
 
hi

I want to move a folder from USB drive to desktop, any directory, let say usr directory. But don't know what the name for usb drive and where to find it, i know i am going to use mv command. Please give me instruction on how to do this, thanks

Meson 02-28-2010 12:47 PM

Your USB device will be /dev/sd[b,c,d,...] (depending on how many other drives you have). Some systems (like those with Gnome) automatically mount your USB drive to something like /media/DEVICENAME (depending on the usb drive's name, id number). If you need to mount it manually, you can do:
Code:

sudo mount /dev/sdb /mnt
(where sdb is the usb drive). After that, you can do:
Code:

mv /mnt/somedir $HOME/Desktop
Keep in mind, mv will put the file/dir in the new location and delete it from the old location. cp will make a copy.

eeguy02 02-28-2010 01:25 PM

thanks

when i do lsusb this is what i have

Bus 005 Device 002: ID 0781:5406 sandisk corp 4Gb flash drive

and some other below that with different ID, so how do I know this drive is sd(b,c,or d)

thanks

Meson 02-28-2010 02:45 PM

Well, if you only have one hard drive in your computer, it's probably going to be sdb, and depending on whether or not you have it partitioned, it might be sdb1 sdb2, etc. You might be able to get a definitive answer by checking the output of
Code:

ls -l /dev/disk/by-id

catkin 02-28-2010 11:49 PM

If you know the UUID of the file system the folder is on then you can mount the file system:
Code:

mount /dev/disk/by-uuid/<the UUID> /<some mount directory>
for example
Code:

mount /dev/disk/by-uuid/efa8a079-ab80-41c9-b018-85810dd3c45d /mnt
.
You can find out the UUID by examining the links in /dev/disk/by-uuid/ and then plugging in the USB HDD; a new link should appear pointing to the /dev/s[a-][1-] device that has just been created.

rhadmn 03-01-2010 12:23 AM

Usb drive, how to locate it, how to move folder from Usb drive to usr directory
 
Hi,

Just use the below command to know ur new USB-HDD media connected.


# fdisk -l


The above command will give the output of all the Usb-Hdd media connected to the particular Host.


You can just examine the drives and confirm the respective drive and mount it if it is not already mounted.

After that use the below command to copy the particular dir from Usb-Hdd to ur Desktop.


# cp -r /mnt/<dir> $HOME/Desktop [this cmd will copy the directory]

# mv /mnt/<dir> $HOME/Desktop [this cmd will move ie cut and paste the directory]


Please let me know if u r not clear.

Regards,
rhadmn


All times are GMT -5. The time now is 11:01 PM.