LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2009, 11:09 AM   #1
ChrisAunchman
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
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
 
Old 06-05-2009, 11:41 AM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
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
 
Old 06-05-2009, 11:56 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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).
 
Old 06-05-2009, 11:59 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by ChrisAunchman View Post
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
 
Old 06-05-2009, 11:59 AM   #5
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
1.plug in usb device.
2.fdisk -l
 
Old 06-05-2009, 01:39 PM   #6
ChrisAunchman
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 06-05-2009, 01:43 PM   #7
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Could you please do
Code:
echo $PATH
as I asked you to, please
 
Old 06-05-2009, 04:13 PM   #8
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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?
 
Old 06-05-2009, 06:20 PM   #9
ChrisAunchman
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
basic commands siawash Linux - Newbie 12 02-05-2008 07:46 PM
Basic Commands Instantly Linux - Newbie 2 06-29-2007 05:03 PM
looking for basic commands etc? lchisholm SUSE / openSUSE 4 05-03-2007 01:15 AM
Basic Commands Help willbasmith Linux - Hardware 1 02-16-2007 10:05 AM
Basic commands? MrPolite Linux - General 5 11-08-2002 10:19 PM


All times are GMT -5. The time now is 09:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration