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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-16-2006, 06:15 AM
|
#1
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Rep:
|
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.
|
|
|
03-16-2006, 06:47 AM
|
#2
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
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,
|
|
|
03-16-2006, 08:18 AM
|
#3
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Original Poster
Rep:
|
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
|
|
|
03-16-2006, 08:45 AM
|
#4
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
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"?
|
|
|
03-16-2006, 01:25 PM
|
#5
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Original Poster
Rep:
|
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.
|
|
|
03-16-2006, 01:45 PM
|
#6
|
Member
Registered: Feb 2005
Location: Ontario, Canada
Distribution: Gentoo, Slackware
Posts: 345
Rep:
|
/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.
|
|
|
03-16-2006, 01:46 PM
|
#7
|
Member
Registered: Jan 2004
Location: Manitoba, Canada
Distribution: Debian
Posts: 454
Rep:
|
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.
|
|
|
03-16-2006, 01:53 PM
|
#8
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep: 
|
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.
|
|
|
03-16-2006, 02:02 PM
|
#9
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
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,
|
|
|
03-16-2006, 05:35 PM
|
#10
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Original Poster
Rep:
|
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
|
|
|
03-17-2006, 04:44 AM
|
#11
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Original Poster
Rep:
|
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
|
|
|
03-17-2006, 05:04 AM
|
#12
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
Quote:
Hmmm, the badblock check finished fine (filesize of 0kb) but the mkreiserfs command wasn't found...
|
try mkfs.reiserfs....
|
|
|
03-17-2006, 11:37 AM
|
#13
|
LQ Newbie
Registered: Mar 2006
Posts: 10
Original Poster
Rep:
|
Thanks Marozsas. I tried but...
Quote:
# mkfs.reiserfs -b 4096 -B /tmp/badblocks.hdc1 /dev/hdc1
-bash: mkfs.reiserfs: command not found
|
hmmm..
|
|
|
03-17-2006, 11:56 AM
|
#14
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 07:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|