LinuxQuestions.org
Review your favorite Linux distribution.
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 09-10-2010, 03:24 PM   #1
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Rep: Reputation: 4
Managing partitions and devices confused me :(


Hey guys, so I hate to post in the noob area, but it is a noob question. I have been working with linux for some time now. I worked for a few major josting companies, now working for a company that creates mobile applications and hosts them in our DC on RHEL servers. Ive been managing linux servers for some time now. I dont really consider myself a newbie.

My problem is.. For some reason, I just cant grasp the skills required to manage partitions and mount devices on linux. I dont know why! It just confuses the hell out of me... I can setup LAMP servers, fix other peoples servers that are configured like crap, troubleshoot them like theres no tomorrow, but if you ask me to mound /dev/hda1... ill prob break something.

I tried to mount an external HDD once, and I ended up wiping everything out of it, so that sucks.

My question is, is there an idiot proof tutorial that someone here would recommend that I can read that will sort of fill in the blanks on mount, umount, fdisk, mkfs, etc etc..

I am reading the RHCE prep guide, and ironically... anything PAST chapter 2 is easy, chapter 2 itself is where they talk about mounting file systems, formatting them, managing partitions, and everything in the /dev directory, and I just cant grasp it.

I start a new job paying double what my last job paid, and im doing nothing but managing linux servers (rhel), so id like to get a grasp on this.

Thanks!
 
Old 09-10-2010, 03:46 PM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779
This is a rather general question and as such can only be answered in general terms. Try this document. It looks pretty comprehensive: http://www.techotopia.com/index.php/..._RHEL_5_System.

Is there something specific that you are having trouble grasping? I understand the commands can be intimidating. There is a lot of arcane flags and terminology associated with them and as you discovered, the results can be profound. The man pages are usually a relatively good reference, but can be difficult to follow, especially at first.
 
Old 09-10-2010, 03:47 PM   #3
roreilly
Member
 
Registered: Aug 2006
Location: Canada
Distribution: Debian, Slackware
Posts: 106

Rep: Reputation: 28
Maybe this will help you:

http://www.tomshardware.com/reviews/...de,2293-5.html

To simplify linux partitions, a simple breakdown would be:

hda = 1st hd on ide controller 1
hda1 = 1st partition on 1st hd
hda2 = 2nd partition on 1st hd.

hdb = 2nd hd on ide controller 1

hdc = 1st hd on ide controller 2
hdd = 2nd hd on ide controller 2

sda = 1st (scsi/sata) hd on sata port 1

etc.

As for particular partitioning schemes, there are many popular ways to partition a server.

I would recommend you google "Understanding Linux partitions" and find some more basic primers.
There are some articles that explain this in windows terms for people that are more familiar with windows partitions.

As for mounting, that's a whole new class. A specific example of what you want to mount and the concerns you have doing
so may help us assist you.

R.

Last edited by roreilly; 09-10-2010 at 03:51 PM.
 
Old 09-17-2010, 06:30 PM   #4
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by roreilly View Post
Maybe this will help you:

http://www.tomshardware.com/reviews/...de,2293-5.html

To simplify linux partitions, a simple breakdown would be:

hda = 1st hd on ide controller 1
hda1 = 1st partition on 1st hd
hda2 = 2nd partition on 1st hd.

hdb = 2nd hd on ide controller 1

hdc = 1st hd on ide controller 2
hdd = 2nd hd on ide controller 2

sda = 1st (scsi/sata) hd on sata port 1

etc.

As for particular partitioning schemes, there are many popular ways to partition a server.

I would recommend you google "Understanding Linux partitions" and find some more basic primers.
There are some articles that explain this in windows terms for people that are more familiar with windows partitions.

As for mounting, that's a whole new class. A specific example of what you want to mount and the concerns you have doing
so may help us assist you.

R.
Believe it or not, thats pretty useful, lol.

So you have hda as your primary, that has your OS and everything bla bla. Lets say you have hdb and you mount it as /backup for the backup files, what if you partition it so there is hdb1 for the backups for /home and then hdb2 for the backups for hdb2? Would everything thats in hdb right now go into hdb1?

I should take a class on this, I really feel stupid asking, I manage multiple servers at softlayer, fdc, the planet, crystaltech, and multiple VPS machines, I can do everything except this basic stuff.
 
Old 09-17-2010, 11:38 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,857
Blog Entries: 18

Rep: Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339
I remember how much googling I did the first time I added a new hard drive to my computer. I finally muddled through, but I think I had several false starts along the way.

My motto is, "Every question is easy when you know the answer."

Here's a tutorial I found that seems to lay it out pretty well.
 
1 members found this post helpful.
Old 09-18-2010, 12:42 AM   #6
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Hi,

This may help you a bit:

Now days we have SATA HDD so HDD naming conventions will be

For SATA

sda first hdd
sdb second hdd(if you insert usb or second hdd ;it willbe sdb)

Get the details of HDD using
Code:
fdisk -l
there you will get the hdd details

if you have dual boot system then you will have

sda1 windowsc drive NTFS
sda2 windowsd drive NTFS
sda3 Extended
sda4 windowse drive
sda5 linux / ext3 partition
sda6 swap partition
sda7 /home partition

suppose you want to know which partition is mounted in linux then
use it will show which partition is mounted where
Code:
mount
also df command as given below will show the free disk space of mounted system
Code:
df -h
If you have some free space and want to create two more partition one is ext3 and other NTFS partition then do this
Code:
fdisk -l
Code:
fdsik /dev/sda
Press l to list partition
Press n to create new partition
Press twice then give partition space +20GB
Press t and then give 83 for ext3
Press w to save
Press q to quit

Same way to create a NTFS partition

Press l to list partition
Press n to create new partition
Press twice then give partion sapce +20GB
Press t and then give 7 for NTFS partition

Now we have two new partitions

/dev/sda8 and /dev/sda9
Press w to

Now to format these two partitions

For ext3
Code:
mke2fs -j /dev/sda8
For vfat
Code:
mkfs.vfat /dev/sda9
Now to mount these two partions
Code:
mkdir /mnt/data
mkdir /mnt/fdrive
Code:
mount /dev/sda8 /mnt/data
mount /dev/sda9 /mnt/fdrive
To list mounted partition
Code:
mount
To unmount partitions
Code:
umount /mnt/data
umount /mnt/fdrive

Last edited by prayag_pjs; 09-18-2010 at 12:46 AM.
 
Old 09-18-2010, 12:45 AM   #7
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
You are already referring RHCE guide;it will help you!

This link will also help you a lot

http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
 
Old 09-18-2010, 02:09 AM   #8
netmar
LQ Newbie
 
Registered: Jul 2004
Location: Durham, NC
Distribution: Ubuntu 10.04 (I'd rather use Gentoo)
Posts: 23

Rep: Reputation: 3
It's funny, but until I thought about the answer to your question, I really didn't realize just how complicated device partitioning and filesystem handling was -- I've just been doing it for so long that I don't see it anymore. There are actually five layers and each has it's quirks:

1) hardware layer -- the actual bits and pieces plugged in to your machine
2) device layer -- how those bits are treated by the kernel and drivers
3) partition layer -- how devices are split up (and joined)
4) filesystem layer -- how partitions are formatted so that you can actually store data on them
5) mounting layer -- how all the filesystems fit together

The hardware layer is pretty simple -- you usually have devices plugged into IDE(PATA), SCSI, SATA, or USB controllers. Most of these are detected by the kernel either at boot time, or when you plug them in. Then the fun starts.

All linux devices are run through the /dev filesystem (dev stands for devices). In the old days, all supported devices were created in /dev when the system was installed. If the actual hardware existed, the dev node was used. If not, the node just pointed to nowhere. Nowadays, udev, hal, and sysfs dynamically recognize hardware at each boot(or when added) and create the appropriate nodes as needed. As long as the kernel can see a device, it should have a dev node.

There are basically to types of device nodes: character devices(mice, monitors, keyboards) and block devices (disk drives). The kernel treats any storage device as a block device, and there are really only two kinds that you'll have to worry about.

1) All devices that start with hd are old-style hard drives (IDE or MFM/RLL). You may still see the occasional IDE drive around, and most CD/DVD drives still attach via IDE.

2) All devices that start with sd are SCSI drives. For various reasons, this now includes SATA and USB drives, and so most of what you'll see is these.

Either kind of drive is then lettered, so the first drive is hda or sda, the second hdb/sdb, and so on.

Partitions go on top of this scheme, and are numbered rather than lettered. So hda1 is the first partition on the first IDE drive (primary controller master drive), and sdb3 is the third partition on the second SCSI/SATA/USB drive.

Standard partitioning in linux allows only four primary partitions on a hard drive, which are always numbered 1-4. If you want more, then you have to create an extended partition (in one of the first four partitions) and add the remaining as logical partitions within the extended partition.

So if you know that you want six identical partitions on disk sda(the first SCSI drive), then you would create three "regular" partitions (sda1,sda2,sda3) which would take half of the drive space. Then you would add one more partition, sda4, as an extended partition with the other half of the space. Then the last three (sda5,sda6,sda7) would be added as logical partitions in the same space as sda4.

Now it might also be a good time to mention that each partition has a type as well as a size. In fact an extended partition is one of those types, and it is automatically assigned when you create a partition as extended in fdisk. All other partitions are assigned a default type of "Linux" which has the code 83. The other most common type of partition is a "Linux swap" partition, which is code 82.

The other two partition types that you will likely see working on servers are Linux RAID (software RAID) and LVM (Logical Volume Manager). Both of these are used to combine partitions into new devices. For RAID, these devices are labeled /dev/md0, /dev/md1, etc. and for LVM, it's usually something like /dev/mapper/VolGroup00-LogVol00. These can then be treated just like partitions, so /dev/md0 is just the same as /dev/sda1, and is already set to type "Linux."

Finally, we get to the filesystem. Linux supports several, but the ones you're most likely to see are ext2/3/4, xfs, and jfs. In any case, the command for creating a filesystem is pretty much the same -- mkfs.ext3 or mkfs.ext4 or mkfs.jfs . . . you get the idea.

Now all you have to do is actually mount the filesystem somewhere. At least one filesystem has to be mounted as / and it has to contain mount points (directories) for all of the other filesystems. So if you want to manually mount a USB drive, say, then you would have to create a directory under, say, /mnt called usbstick (so it'd be /mnt/usbstick). If the stick was formatted with jfs, had a single partition, and was /dev/sdc when plugged in then you'd mount with the command
Code:
mount -t jfs /dev/sdc1 /mnt/usbstick
If you had two hard drives, both old IDE, formatted with ext3, and with only one partition apiece -- and you wanted to use one for /usr, then
Code:
mount -t ext3 /dev/hda1 /
mount -t ext3 /dev/hdb1 /usr
And it just gets more complicated as you introduce multiple partitions, RAID arrays, and swap partitions.

Hope this helped.
 
1 members found this post helpful.
Old 09-18-2010, 08:11 AM   #9
hughetorrance
Member
 
Registered: Aug 2009
Location: London North West
Distribution: x86_64 Slack 13.37 current : +others
Posts: 459

Rep: Reputation: 59
One problem is that its not always logical so you just have to find out how it is and thats that,a good example is umount,why is the n missing,I mean if you knew that mount was mount you might try unmount and that would not work since the correct syntax is umount.
Another thing is,its not really possible to know absolutely everything,everyone has experience in certain domains so everyone has their unknown,mine just happens to be infinitely larger than my known... LOL
Finally,when I look at things in order to find out what I need to know I look at the subject from at least two perspectives,very close up and from a great distance or put it this way... you cant see the wood for the trees and you cant see the trees for the wood...time also comes into it,I am a very slow learner so it takes days or weeks or months or years before I finally get a grip of what I am trying to understand and so far there is so much that I don,t know that I reckon I will never know... Ohh well LOL

Last edited by hughetorrance; 09-18-2010 at 08:18 AM.
 
Old 09-19-2010, 10:57 PM   #10
iuselinux
LQ Newbie
 
Registered: Sep 2010
Posts: 23

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by frankbell View Post
I remember how much googling I did the first time I added a new hard drive to my computer. I finally muddled through, but I think I had several false starts along the way.

My motto is, "Every question is easy when you know the answer."

Here's a tutorial I found that seems to lay it out pretty well.
My motto is "Experience is what you get, when you don't get what you want"

Thanks guys! Reading/learning everything in your replies and links, looks helpful so far!
 
Old 09-19-2010, 11:44 PM   #11
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,851
Blog Entries: 36

Rep: Reputation: 455Reputation: 455Reputation: 455Reputation: 455Reputation: 455
LinuxQuestions does have a wiki which is pretty comprehensive.

http://wiki.linuxquestions.org/wiki/Commands#M
  • mount partitions
  • Covering devices.
  • Bench, backup, and wipe drives using the dd command.
  • Determine free space using df and du.
  • What is a partition?
  • How to partition using fdisk?
  • You can also check out the parted command which partitions and labels drives.
  • You can even use the ls command to ls -lah /dev/disk/by-uuid/. If you see a link to ../../sda1 then that is the same as /dev/sda1. The UUID is used in fstab by Ubuntu and many derivatives.

Don't forget to view man pages of all associated commands in the terminal as well. The man pages are comprehensive and very useful.

SAM

Last edited by sag47; 09-19-2010 at 11:55 PM.
 
Old 09-20-2010, 12:36 AM   #12
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by iuselinux View Post
Believe it or not, thats pretty useful, lol.

So you have hda as your primary, that has your OS and everything bla bla. Lets say you have hdb and you mount it as /backup for the backup files, what if you partition it so there is hdb1 for the backups for /home and then hdb2 for the backups for hdb2? Would everything thats in hdb right now go into hdb1?
Not quite
hda, hdb etc are your non-partitioned disks. hda1, hda2, hdb1 etc are partitions on those disks.

It's probably possibly to mount /dev/hdb on /backup (never tried it), but one mounts a partition on a mountpoint, not a disk.
So you should mount (in your example) /dev/hdb1 on /home (and /dev/hdb2 on /backup)
 
Old 09-22-2010, 10:28 PM   #13
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,857
Blog Entries: 18

Rep: Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339Reputation: 3339
Quote:
Originally Posted by iuselinux View Post
My motto is "Experience is what you get, when you don't get what you want"
iuselinux, may I have permission to quote you on my blog as a Quote of the Day?
 
  


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
managing vfat partitions from linux bldrco Linux - Software 2 02-05-2010 02:23 PM
LXer: Btrfs 0.14, Managing Multiple Devices LXer Syndicated Linux News 0 04-30-2008 09:10 PM
question on managing disk partitions mz043 Linux - Newbie 6 03-29-2007 12:42 PM
Managing disks and partitions in Suse 10 cvzyl Linux - Hardware 2 07-30-2006 03:30 AM
managing partitions sakman Linux - Newbie 2 06-24-2005 10:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:18 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