LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Really new and need help with basic commands (how to know what dev a USB is reconized (https://www.linuxquestions.org/questions/linux-newbie-8/really-new-and-need-help-with-basic-commands-how-to-know-what-dev-a-usb-is-reconized-730930/)

ChrisAunchman 06-05-2009 10:09 AM

Really new and need help with basic commands (how to know what dev a USB is reconized
 
Hey All,
I am really new to Linux and I need some help mounting a blank USB hard drive to a system we have. I have already mounted a USB thumbdrive, CD drive and floppy drive without any issues. Here is what I am wondering:
1) How do I check what the USB harddrive is being reconized as when I plug in the USB connection. Right now I am trying to see it with "tail /var/log/messages" but I can't see where it shows up as any dev what should I bee looking for? Where is the best place to find how this device was reconized.

2) Would it help if the harddisk already was formatted with a Linux file structure? It seems as though this system does not reconize fdisk as a CMD.

3) And last what is the best command to use, once I have the harddrive connected, to copy one complete folder (Drive) to the harddrive I just connected. Is it using the cp cmd or dd cmd??

Thanks,
Chris

jamescondron 06-05-2009 10:41 AM

Plug it in and hit
Code:

dmesg |tail
You should see something like:

Code:

jc@jcmain:~$ dmesg|tail
[171334.033445] sd 9:0:0:0: [sdc] Write Protect is off
[171334.033445] sd 9:0:0:0: [sdc] Mode Sense: 43 00 00 00
[171334.033445] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[171334.036903] sd 9:0:0:0: [sdc] 3963904 512-byte hardware sectors (2030 MB)
[171334.037769] sd 9:0:0:0: [sdc] Write Protect is off
[171334.037769] sd 9:0:0:0: [sdc] Mode Sense: 43 00 00 00
[171334.037769] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[171334.037769]  sdc: sdc1
[171334.133551] sd 9:0:0:0: [sdc] Attached SCSI removable disk
[171334.133551] sd 9:0:0:0: Attached scsi generic sg3 type 0

This tells me my device is sdc, so is at /dev/sdc- If this does nothing, try
Code:

lsusb
and see if it is recognised.

What exactly happens when you type in fdisk? Specific error message? It is in /sbin/ so what is the outcome of
Code:

echo $PATH
cp is better, look at
Code:

man dd
and work out why

David the H. 06-05-2009 10:56 AM

1) Device changes will generally be logged in /var/log/dmesg rather than messages. There's also a shortcut "dmesg" command for displaying the file.

It's also possible to run something like "udevadmin monitor" as root to watch what happens when udev finds a new device in real time. And 'cat /proc/partitions' will show you all available block devices, but it won't tell you which is which.

2) fdisk should be available on most systems as standard. It's restricted to the root user by default though (it's usually found in /sbin). If you really don't have it then you should be able to easily install it through your package manager. And there are other similar commands also, such as cfdisk and sfdisk.

It shouldn't matter to any of the above whether the device is formatted or not. The only difference is that a formatted disk will show partition numbers (sda1, sda2) in addition to the main drive device node (sda). And of course fdisk is what you use to do the partitioning and formatting in the first place.

Speaking of which, fdisk -l is another way to list your available drives, including device nodes. Maybe the best, as it shows you exactly which drive is which.

3) dd is designed for mirroring exact bit-by-bit copies of data. It's good to use if you want to duplicate one drive to another (I duplicated a compact flash card just this week with it, for example). But if you just want to do a simple copy of files and directories, the standard copy tools are usually easier and safer. dd can be dangerous to use; one mistake in typing and you can wipe out a whole disk (been there, done that).

jdkaye 06-05-2009 10:59 AM

Quote:

Originally Posted by ChrisAunchman (Post 3564246)
Hey All,
I am really new to Linux and I need some help mounting a blank USB hard drive to a system we have. I have already mounted a USB thumbdrive, CD drive and floppy drive without any issues. Here is what I am wondering:
1) How do I check what the USB harddrive is being reconized as when I plug in the USB connection. Right now I am trying to see it with "tail /var/log/messages" but I can't see where it shows up as any dev what should I bee looking for? Where is the best place to find how this device was reconized.

2) Would it help if the harddisk already was formatted with a Linux file structure? It seems as though this system does not reconize fdisk as a CMD.

3) And last what is the best command to use, once I have the harddrive connected, to copy one complete folder (Drive) to the harddrive I just connected. Is it using the cp cmd or dd cmd??

Thanks,
Chris

1. Typing the command
Code:

lsusb
while the usb device is plugged in will give you an idea if it being recognised.
2. I would suggest you format it first since mounting requires some sort of file system on it. You need to know what device name is assigned to the usb device. Mine is called /dev/sda1 but yours could be different. When I plug mine "live" a message pops up in the tty (ctl-alt-F1) and I can see what it's being called.

Once you have that info you can use mke2fs (run as root or with sudo) with the appropriate options to build the file system.
cheers,
jdk

saagar 06-05-2009 10:59 AM

1.plug in usb device.
2.fdisk -l

ChrisAunchman 06-05-2009 12:39 PM

WOW what quick replies....
 
Thanks for all the quick replies.....when i attempt to use fdisk I get that fdisk is not a reconized command message. I do login as what they consider a super user so I beleive that I have all the privlages. This isn't a normal system I am attempting to do things with so I am sure that they tailored it to what they want on it but I will be sure to check the folders for the fdisk. Unfortunetly I can't install it with any updates. So if I wanted to copy one folder (disk) to another would a copy command like:
cp /mnt/database /mnt/scsi

copy everything from the database to the scsi folder? or do I have to ad anything to it.

Regards,
Chris

jamescondron 06-05-2009 12:43 PM

Could you please do
Code:

echo $PATH
as I asked you to, please

David the H. 06-05-2009 03:13 PM

And what do you mean by "not a normal system"? You really should describe in more detail what distro/setup you're using, what you've done so far that has and hasn't worked, and any other details you think may be relevant.

I'm also a bit confused by your description. Sometimes it sounds like you're trying to copy a directory, and sometimes it sounds like you're trying to copy an entire drive or partition. So are you trying to duplicate an entire disk? Or do you want to create a new disk with a different partition layout, then copy some files and folders to it?

ChrisAunchman 06-05-2009 05:20 PM

I am trying to copy a whole drive. I call it a folder, just cause that is what it looks like on the system. The distro is Redhat 6.something. Yes it is not a normal system. thanks for the help. I will not have access to the system till next week sometime so I can't do the type ins unfortunetly.


All times are GMT -5. The time now is 12:19 PM.