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 |
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, |
Thanks Marozsas,
I ran those two commands you mentioned: Quote:
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 |
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"? |
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. |
/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. |
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. |
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. |
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 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 Code:
# mkdir /backup good luck, |
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 |
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 |
Quote:
|
Thanks Marozsas. I tried but...
Quote:
|
You do not have the reiser tools installed.
Never mind. Use a ext3 filesystem. Code:
# mke2fs -j /dev/hdc1 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 04:27 AM. |