LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-16-2006, 06:15 AM   #1
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Rep: Reputation: 0
Question Accessing Another Hard Drive?


I'm a newbie so hopefully this will have an easy answer.

Our Raid Hard Drives (3) were filling up so we had the server company where the Linux server is running install another hard drive... not in raid, just an additional storage drive where some backup files will go.

They said they installed it... but now how to I find it in using the command line? What would it be called? How do I access and store things in the new drive?

Looking at the command line history, I see that when they installed it, they ran the following commands:
> fdisk /dev/hdc
> clear
> hostname
> exit
> ipconfig eth0
> fdisk /dev/hdc
> clear
> df -h


Thanks
John

Last edited by jvanv8; 03-16-2006 at 06:45 AM.
 
Old 03-16-2006, 06:47 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
The command "fdisk -l" would print all partitions in all disks your system have.

Cross check this output with the output of "mount" which list all active partitions that are mounted and are in use in your system.

As a hint, a really new disk wouldn't have a partition table and it should be easier to find in the "fdisk -l" output.

cheers,
 
Old 03-16-2006, 08:18 AM   #3
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks Marozsas,
I ran those two commands you mentioned:
Quote:
# fdisk -l
Disk /dev/sda: 73.3 GB, 73397698560 bytes
255 heads, 63 sectors/track, 8923 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 8669 69529320 83 Linux
/dev/sda3 8670 8923 2040255 82 Linux swap

Disk /dev/hdc: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/hdc doesn't contain a valid partition table


# mount
/dev/sda2 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
I'm guessing that dev/hdc is the new hard drive correct?
And is it bad that it says "Disk /dev/hdc doesn't contain a valid partition table"?
Do I need to configure this drive or something before I can use it?

Thanks for putting up with my newbie questions.
- John
 
Old 03-16-2006, 08:45 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Yes. Looks like /dev/hdc is the new drive.
Nothing wrong with "doesn't contain a valid partition table". It is normal in a new disk.

How to you want to use this new disk ? It is a 80G disk. Do you want more than one partition, may be a 50GB and another 30G or all 80G in only one partition ?

What is the mount point for theses partitions ? "/disk1" and "/disk2" or all disk in "/export/backup"?
 
Old 03-16-2006, 01:25 PM   #5
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Original Poster
Rep: Reputation: 0
the only thing I want to do with the disk is store a backup or 2 of a database on it. The database is about 32 GB.
So can I store a file on this disk or browse the contents?
Being the newbie that I am, I tried:

# cd dev/hdc
-bash: cd: dev/hdc: Not a directory

So how exactly do you use (or is the term mount?) this new drive? I would like to just copy a handful of files from the original drive to the new one.
 
Old 03-16-2006, 01:45 PM   #6
geeman2.0
Member
 
Registered: Feb 2005
Location: Ontario, Canada
Distribution: Gentoo, Slackware
Posts: 345

Rep: Reputation: 30
/dev/hdc is the device itself, you need to create partitions on it.
Use "fdisk /dev/hdc" to create at least one partition.

Then you need to format the partition.
After this is done, you can then mount the partition to a directory.
This would be done by "mount /dev/hdc1 /mnt/point"
/dev/hdc1 refers to the first partition on /dev/hdc, and /dev/hdc2 would be the second if you create two, and so on.
/mnt/point would be the directory you want to mount the new partition to.
Once it's mounted, you can write to it by placing files in /mnt/point.
 
Old 03-16-2006, 01:46 PM   #7
RobertP
Member
 
Registered: Jan 2004
Location: Manitoba, Canada
Distribution: Debian
Posts: 454

Rep: Reputation: 32
fdisk /dev/hdc
Create your partition, perhaps one primary, Linux type
cat /proc/filesystems
Choose the filesystem that you like.
mkfs -t jfs /dev/hdc1
Change jfs to what you like. A journalling filesytem is more reliable.

mkdir somedirectory
mount /dev/hdc1 somedirectory

make somedirectory what you want, e.g. /home/you/backups/ or /root/backups
When you are done backing up, you may
umount /dev/hdc1
You can put a line in /etc/fstab, too, if you want the thing to mount at boot time.
 
Old 03-16-2006, 01:53 PM   #8
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Actually, the partition creation could be bypassed if OP just wants to back up databases that are on the RAID. The new drive is big enough; the dd command could be used to image the RAID drive to the new drive.

This would be done simply as this:

dd if=/dev/sda of=/dev/hdc

Aside from copying the entire drive, this would also copy the partition table and the new drive would be defacto partitioned. It would also have some blank space at the end, which could be dealt with (if at all) at a later time.
 
Old 03-16-2006, 02:02 PM   #9
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Ok. First, you need to create a 80G partition on your new disk.

Run fdisk on the target disk (I mean "fdisk /dev/hdc"), then the "o" command to create a empty partition table, and after that, the command "n" to create new primary partition, number 1, which starts at cylinder 1 and ends at last cylinder (use the default answers suggested by fdisk).
Use the "p" command to print the partition table and it looks fine, the "w" to write the partition table to the disk.

Run "fdisk -l /dev/hdc" to check the partition table is there, as you specified.

Now, you need to create a file system structure on /dev/hdc1.
Here there is a optional step you may want to know about. Searching for bad blocks, even in a new disk, is a good idea, specially if this disk will hold backup, important stuff, or in a production environment. If installing this disk is your job and you want to save your ass, search for badblocks on this disk. This is a time consuming operation. It will take several hours. I mean 20-30 hours !
{code]
# badblocks -sw -b 4096 -o /tmp/badblocks.hdc1 /dev/hdc1
[/code]

This command will make a write-read test with several patterns (0000, 1010, 0101, 1111) on every block of disk. A badblocks list (if any) will be created on /tmp/badblocks.hdc1. This list will be used in the next step.

Code:
# mkreiserfs -b 4096 -B /tmp/badblocks.hdc1 /dev/hdc1
Here, I choose to use a Reiser file system, rather than a most commum ext3 file system. The reason ? My experience says a reiser file system is more robust to rebuild the disk after a failure. I have lost less files in a reiser file system if compared to ext3. Your mileage may vary, of course

Finally, you just need to mount the disk.
Edit the /etc/fstab and add a entry for this new disk. Something like this:
Code:
/dev/hdc1            /backup                 reiserfs   acl,user_xattr        1 2
Create the mount point and mount the disk
Code:
# mkdir /backup
# mount /backup
# df -lh /backup
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc1             80G   0M   80G   0% /backup
Wow, after that a need a beer

good luck,
 
Old 03-16-2006, 05:35 PM   #10
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Wow, thanks Marozsas! If you ever write a Linux For Dummies book let me know and I'll buy a few copies.
Seems to be working fine and I am doing the disk check now (should be good I hope, its new).
I'll skip the beer step since I'm not a fan... even though I am now living in the Czech Republic which is suppose to have "good" beer.
Thanks again for helping me learn something!
- John
 
Old 03-17-2006, 04:44 AM   #11
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Hmmm, the badblock check finished fine (filesize of 0kb) but the mkreiserfs command wasn't found...
Looks like I either need to install it or try a different filesystem...
Since this seems like a different topic, I posted a new thread for this issue:
http://www.linuxquestions.org/questi...27#post2154727

Thanks
 
Old 03-17-2006, 05:04 AM   #12
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Quote:
Hmmm, the badblock check finished fine (filesize of 0kb) but the mkreiserfs command wasn't found...
try mkfs.reiserfs....
 
Old 03-17-2006, 11:37 AM   #13
jvanv8
LQ Newbie
 
Registered: Mar 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks Marozsas. I tried but...
Quote:
# mkfs.reiserfs -b 4096 -B /tmp/badblocks.hdc1 /dev/hdc1
-bash: mkfs.reiserfs: command not found
hmmm..
 
Old 03-17-2006, 11:56 AM   #14
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
You do not have the reiser tools installed.
Never mind. Use a ext3 filesystem.
Code:
# mke2fs -j /dev/hdc1
or
# mkfs.ext3 /dev/hdc1
The "-j" option to mke2fs creates a ext3 filesystem.
Since you told me your disk is badblocks free, you don't need any additional option.

You need to change the /etc/fstab entry. Change the 3rd column from reiserfs to ext3 and you are done.

see'ya
 
  


Reply



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
Accessing Windows hard Drive nikko05 Linux - Hardware 10 12-20-2005 10:58 AM
accessing second hard drive Damon Spector Linux - Hardware 1 04-23-2005 01:18 AM
accessing second hard drive in mandrake 10.1 laina Linux - Newbie 2 12-28-2004 01:31 AM
Accessing windows hard drive eastsidecrew Linux - Newbie 4 04-20-2004 12:47 PM
Processes accessing the Hard drive albean Linux - Newbie 2 11-19-2002 05:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:04 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
Open Source Consulting | Domain Registration