LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Add a Hard Drive to Linux (https://www.linuxquestions.org/questions/linux-hardware-18/add-a-hard-drive-to-linux-291968/)

AndeAnderson 02-18-2005 02:39 PM

Add a Hard Drive to Linux
 
I accomplished a Debian Sarge Net Install and thought it worked pretty well. But, I have been surfing and searching and not finding the basic guidelines needed for a newbie to Linux for adding a second hard drive to the system. Much less how to start a program from the command line.

I see instructions that are geared toward someone already familiar with the system commands, idiosyncracies and gotchas found in Linux. Plus, everyone seems fixated on the idea that everyone has or wants to set up their Linux system with a multiple boot capability. That is just not true.

For example:

Step one "Use fdisk." I'm sorry folks, but the Linux fdisk may have the same name, but it definitely does NOT do the same job as the DOS fdisk I am familiar with. Plus, all the Linux fdisk tries to do is fdisk my cd-rom drive? Maybe because it is the First Primary IDE Drive? The new Hard Drive is the Secondary Primary IDE Drive. The main/boot hard drive is a SCSI Hard Drive.

Step two "mount the hard drive." I'm not sure if you mean, in a picture frame or on a horse. ;^) In order to "mount" the device you have to modify the "fstab" file. Huh??? How do you find this file and how do you open it to modify it? Plus, what gets modified in it? What is a "mount point"?

Step three "set the disk partition to use the file system you want to use." What is the command to format the hard drive in Linux? I thought the partition was set by the fdisk command?

If Linux can see and prepare the Hard Drive during the initial installation why can't that same procedure be used for the addition or replacement of additional hard drives? It only took Debian about 3 minutes to find and set-up the original SCSI hard drive to be used for Linux. How hard would it be to remove that portion of installation code and create a hard drive management utility?

I can't even see what is on drive a:, c:, or d:? If drive letters are even used? How do you find what files are on a specific drive or in a specific directory?

Isn't it funny that "basic system commands like fdisk and mount" are not listed, explained or available in either the Help Files or Linux Documentation? We are just expected to know them and how to use them.

So, how does one work the magic of installing a second hard drive on a plain "Linux Boot Only" computer? I'm not even using a GUI. I am going from the Command Line.

If nothing else I'll just try to reinstall Debian from scratch. Maybe that would enable the second hard drive to be used?

Thanks from the confused one. (And I thought Linux would be easier than IIS.)

satinet 02-18-2005 03:47 PM

Okay Ande Sounds like you are a little frustrated.

Firstly there are NO drive letters in unix or linux. So forget about C: D: A: etc.

What's a mount point?
A file's a file's a file. Basically a mount point is where pyshical disks and partitions on your system put themselves. You don't need to worry too much about the complexities of it for now. Basically, you need to know that your second disk is going to be on a mount point. Which YOU can choose.

Type 'cat /etc/fstab' to see how your system is set up. Mine is: (cat displays the contents of file - top command)

/dev/hda6 swap swap defaults 0 0
/dev/hda5 / reiserfs defaults 1 1
/dev/hda7 /home ext3 defaults 1 2
/dev/hda1 /windows ntfs ro 1 0 #ro = read only
/dev/hda9 /fat-e vfat auto,gid=100,umask=000 1 0 #umask to set default permissions
/dev/cdrom /mnt/cdrom iso9660 user,noauto,ro 0 0 #user allows anyone to mount it
/dev/uba1 /mnt/stick vfat auto,user 0 0
devpts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0

This is a list of where the disks (left column) or mounted (second column). The third column is the file system type. ntfs, being a windows partition. vfat a fat32 (ms windows/dos) partition.

As you can see I have /home 'mounted' at /dev/hda7 with the file system type of ext3 (linux). The is a partion on my first hard drive (i only have one). you can tell this as all my partitions are listed as /dev/hda?, expect cdrom and usb stick. Don't worry about devpts and proc for now.

So, if I wanted to add a second disk, i would have to

1) physically install the disk
2) run 'hdparm -l' which will tell me about the disks/partitons on my drive.
3) Run 'cfdisk' which is much easier than fdisk, and will enable me to format you new drive. Which will be /dev/hdb
4) decide on a mount point. /new maybe? /stuff Whatever. Note don't try to mount it where the is an existing partition mounted. I could umount /home and remount it on /hda5, then use my second disk to mount /home. but i'll keep it simple.
5) edit my /etc/fstab file (as root). 'pico' or 'vi' maybe. to include a line like:

/dev/hdb1 /stuff ext3 defaults 1 2 (the second last column is about dumping and the last column is about file system checking - don't worry about those '1 2' is fine for your second disk until you are a wizard.)

then type 'mount -a' (mount all i.e '-a' mount points in /etc/fstab that aren't already mounted.)
It's important to note that i would have had to created a folder called /stuff in this example. you have to mount to a directory that already exists.

mkdir /stuff
chmod 777 stuff (change permissions)

You sound keen but very windows- centric. Stick at it and you will be laughing at C: drives before long. If you want to use more than one disk at the same mount point then we are talking about things like LVM and RAID. Lets not.

Anyway, mount points are central to your system. As is /etc/fstab.

Don't despair there is plenty of stuff for new people out there. And people are willing to help.........

check this out for some basics and a guide to vi:

http://wks.uts.ohio-state.edu/basic_...nix_guide.html

and this:

http://wks.uts.ohio-state.edu/basic_...nix_guide.html

or this:

http://www.tuxfiles.org/linuxhelp/fstab.html

this may be useful:

http://www.neowin.net/forum/lofivers...hp/t64329.html

Hope this has been of some help.............

To start a progam for the command like type ./programme where program is the name (if you are in the right directory)
or /usr/lib/mozilla which would start mozilla (if you where in X)

type 'startx' to go graphical if you have this intalled........

coldAndUgly 02-18-2005 03:53 PM

Hello, if you want a partitioning utility that is more akin to fdisk in DOS then use cfdisk.
By default fdisk and cfdisk will partition the primary master, you want to partition the primary slave so:
Code:

cfdisk /dev/hdb
is the command to use.
Quote:

Isn't it funny that "basic system commands like fdisk and mount" are not listed, explained or available in either the Help Files or Linux Documentation? We are just expected to know them and how to use them.
This is not correct at all. It just seems that way at first because you don't know where to look and what to search for.
There is a vast amount of documentation on the web and on your own computer.
Code:

man mount
man fdisk
man cfdisk
man mkfs

That being said here are the instructions you are looking for.
Code:

cfdisk /dev/hdb
Use cfdisk to partition the drive as desired, if unsure; man cfdisk. After the partitions are created you need to format them.
You'll probably want to use ext2, ext3 or reiserfs; I suggest reiserfs. The new partitions will be labeled hdb1, hdb2 as seen in cfdisk so:
Code:

mkfs -t reiserfs /dev/hdb1
and so on, replacing hdb1 with the partition you wish to format.
Once the partitions are created and formatted you need to decide where to mount them.
I personally would use a subdirectory of /mnt I don't use debian so I don't known how its file system is structured.
As root:
Code:

mkdir /mnt/storage
or whatever you want to call the mount point, this can be any arbitrary directory, then:
Code:

mount -t reiserfs /dev/hdb1 /mnt/storage
replacing reiserfs with the file system you chose and /mnt/storage with the directory you wish to mount it to.
Now you can go about using the partition as normal. If you want the partitons to be mounted automatically upon reboot you
need to add a line similar to this in your /etc/fstab file.
Code:

/dev/hdb1        /mnt/storage            reiserfs    defaults        1  2
If unsure man fstab. See how useful the man command is. :)

satinet 02-18-2005 03:57 PM

I think what we are saying here is that there is plenty out there.

it took me a few seconds to find those websites i listed and they are pretty useful.

the best resources:

www.linuxquestions.org
www.google.com
www.google.com/linux

AndeAnderson 02-21-2005 01:18 PM

Thanks
 
Your instructions and understanding are greatly appreciated. :~)

Actually, I'm more frustrated with myself than with Linux. I went to school for Unix and all of this looks so familiar. But, I just can't seem to pull it back from my memory and I feel like I should be able to recall at least the basics.

I think Microsoft has dulled my senses.

"I never lose until I quit trying."

satinet 02-21-2005 01:24 PM

Ande,

Look mate, the best thing about linux, IMHO is the user community. People are just so helpful for no return and there doesn't seem to be too many know it alls.

Anyway, Linux is pretty similar to unix - I'm a unix admin. Not that you can tell. But if anyone wants to know about commands like mt, tr, prorest etc, then I'm your man!

Sounds like you'll be fine after a few weeks of fiddling.

but have you actually fixed it now?

AndeAnderson 02-21-2005 01:41 PM

One Day
 
Thanks for the support and offer.

I haven't had a chance to even look at it yet. I wasn't here for the weekend and this morning I came in to find a Btrieve Database had been trashed after I left Friday night.

So I had to do a restore and repair on the database. Not to mention a couple of other projects which have been given priority.

I'll get to try it later this week.

"I don't lose until I quit trying."

AndeAnderson 02-24-2005 02:06 PM

Only errors and no mounting
 
Hey satinet,

I have tried the procedure you sent and all I end up with is a unable to mount - no mount point specified, after modifying the /fstab file. Was I supposed to type the 'mount -a' command into the /fstab file somewhere? I was trying to use it from the command line after saving the /fstab file.

If I try a shutdown and restart I get an unable to boot error message for a critical system failure - enter root password or hit Ctrl+D to continue.

How can I specify the /stuff as the mount point before it is even created on the new hard drive? I never made it to the

mkdir /stuff
chmod 777 stuff

Is there a step you automatically do that I do not know about?

I did some research and found that the ext3 was for a Linux partition and that vfat was for my windows partition.

I entered this line into the /fstab file:

/dev/hda /data vfat defaults 0 2

I no longer get the error message on boot-up, but after installing MC I can see that the /dev/hda is not getting mounted anyway.

Thanks


All times are GMT -5. The time now is 03:09 AM.