You will generally just use the typee 7 (NTFS for Windows), 82 (for swap) and type 83 for
the Linux Ext3 file system type (the default with most distros). If you look at the
layout above ( here), you'll see 12 partitions on one physical
hard disk. Three of those are for Vista, the rest are Linux. The star (*) next to
/dev/sda3 means that Vista partition is "active" or bootable. The
/dev/sda4 is the default
for the extended partition. Notice that /dev/sda8 is reserved for Linux swap (also where
your current configuration hides when you "hibernate" the machine). The
/dev/sda5 is the
/boot partition where all the Linux boot information resides. The rest of the Linux install is
scattered over the remaining partitions.
It's not necessary to do any of this of course. You can just put the whole install on
one partition and save some hassle but you may regret it. By spreading your programs and
data over several partitions, it's much easier to protect it from loss or corruption. If
there's only one partition (the way most vendors ship their computers), then if you have
to re-install, you wipe out everything and have to start over. Same with Linux. Divy up
the install over several partitions now and save some trouble later (see this). Here's my (current) partitioning scheme:
/dev/sda5 | /boot |
/dev/sdb6 | /usr |
/dev/sdb7 | /usr/local |
/dev/sdb9 | /home |
/dev/sda10 | / |
/dev/sdb11 | /var |
/dev/sdb12 | /files
|
Since I'm using partitions 1,2 and 3 for Vista and partition 4 is extended and partition
8 is for swap, my Linux installation is chopped into 7 pieces. Notice I also added a
directory I've named /files. This is where I download stuff and configure from source.
It's my default download location for all firefox downloads.
I mount /usr/local separately since that's where everything ends up after compiling as a
general rule (some distros prefer /opt). I also mount
/home in its own partition. I
don't really have to parition for /var but some useful stuff ends up there over time.
The whole idea is to preserve a working configuration. If I have to re-install (and I always
do eventually), I can re-use these partitions without formatting them and all my goodies
will still be there.
This is the same technique I've used on coporate servers and mostly for the same
reasons. The difference is corporations are paranoid about downtime and data loss so
this scheme has the additional benefit of disaster avoidance. I could, for instance,
keep a recent rdist copy of, say, /var/mail, on a DVD. If the server got corrupted I
could umount /var on the server, load the DVD and mount it on
/var. I couldn't write to it,
but I could at least recover files without shutting evrything down. Even better a USB
hard disk. plug it in, mount it and you're back in business.
Since Linux doesn't care what's on a mass storage device or even what kind of device it
is, all you have to do mount it. A USB disk can be running and backing stuff up in close
to real-time while mounted under one name and unmounted and then re-mounted under another
name. Let's suppose that the USB disk as mounted as /dev/sdb1 (notice it will be sdb,
the second hard disk) in the directory, /recover. Maybe
/var gets full because of
enormous emails (not that unlikely if there's lots of users). so,
umount /recover
umount /var
mount /dev/sdb1 /var
mount /dev/sda11 /recover
Now /var has some breathing space and, since I re-mounted it elsewhere, I can go through
it and see what I can fix.
This isn't really too likely in the real world but the capability's there. What's really
neat is that you can make any directory a mount point. Suppose you have a web server
(see this) that you'd like available on another machine. Do
you install everything on the other machine, from scratch? No way. Get a USB thumb drive
with the capacity you need, plug it in and then,
mkdir -p /media/USB/apache2
mount /dev/sdb1 /media/USB
cd /usr/local/apache2
find . -depth|cpio -pdv /media/USB/apache2
umount /media/USB
The mkdir -p command will make the all the directories you specify
at one time (the -p option). The find command finds
everything below the specified directory (the dot notation) and all its
sub-directories (the -depth option). The output of this is piped
to the cpio command which copies each file in each directory while
perserving all path information, to the named directory.
The complete
contents of /usr/local/apache2 with all the path information, ends
up on the USB drive. Mount the disk on another machine (as
/media/USB
maybe) and use find and cpio to copy the files and
directories to that
machine using the same process above.
Now take the USB stick to the other server, insert it and mount it as
/usr/local,
restart the web server (service httpd restart) and the webserver will have
everything you had on the original server.
These kinds of things are why you should have several disk partitions and use your mount
points creatively. The best time to set it up is during the OS installation procedure.
So, you're installing Linux, you're prompted for your preferred disk partitioning scheme
and you choose, Custom, and off you go.
I've found that /boot needs about 100Mb, root (/) needs at least 2Gb,
/usr should have 3Gb, /var about 2Gb, /home another 2Gb,
/swap at least 1Gb, /usr/local
about 2Gb and assign the rest to a downloaded files directory,
(/files on my machine).
These are good minimums, use more if you can. Also, if you're dual booting, consider
what the other operating system needs. You may even want to add yet another OS or so,
maybe have three or four on the same disk so plan it out and set your new partitions to
match.
The Grub Bootloader
The next thing you have to figure out is how the new OS will boot. This is where the
grub boot loader comes in. After you've set up your paritions, the
next thing to pay attention to in the install is where you want to put the
grub bootloader. the choices are either the Master Boot Record (MBR, see
this) on the
first hard disk (the default) or the first partition of the partition where
Linux is installed.
This is kind of tricky. If you are dual booting, say Vista and Linux, it's
probably because Vista was pre-installed on your computer and you're adding
Linux. You should already know which partition on the disk holds the Vista
installation and you configured the /boot partition of the Linux
install to be on (hopefully) another partition. The grub bootloader can be
on either partition.
If you are installing to USB thumb drive or a second hard disk, make sure
to select the MBR on that disk, not the primary (Vista) disk. If you are
installing the same physical disk that has the Vista installation, you will
use the same disk but a different partition. You can still write to the MBR
but you have to edit the Operating System choice to make sure that both
show up on the boot menu and point to the right partition.
The Fedora install offers a list with your new install as one option and
the other OS (called "Other"). Click Edit on each to specify the correct
partition for each OS. In the Edit window change the name of each OS to
whatever makes sense to you. What you enter here is what you'll see when
you boot, as a menu choice. Determine the disk and partition in this
window and the disk boot order. Don't panic if you screw up, when you
re-boot, the grub boot menu allows you to change the settings if you get them
wrong during the installation (we'll get to that).
While you're at the grub menu you can also add operating systems to the
boot menu. Since most Windows installations will boot from the first
partition of the first disk (hda1), you can assume that any computer
with Windows intalled will do just that. If you want to add an OS later, you
can create an entry now using either another disk or partition.
Once you get all that figured out (you really just have to do it to see how
it all works and the process varies with different Linux distros),
youll be ready to continue.
Fortunately most distros use grub so the underlying mechanics of setting up
the boot is the same.
When you re-boot later, grub will display its menu of operating systems
choices. You may have to hit a key to see the menu. The grub bootloader
will display the list you created during intallation. Use the arrow keys to
select your OS and hit Enter to boot. If one of the choices won't boot, hit "e"
instead and you can modify the OS boot options. The first line you'll see
is the one with the OS name and the disk and partition it's supposed to
boot from. You can hit "e" on that line to edit it.
The notation will something like, root(hda0,3). If the disk is
wrong (hda0) you can change it. Same with partition (3).
In most cases the disk and partition numbering begins with 0 so partition 3
is actually partition 4. If you were counting from 1 then you may have to
change it. When you finished editting this line, hit Enter and then "b" to
boot. Everything will now work perfectly of course.
After the grub configuration, your install will format the paritions and
you'll be ready to start installing software. This step is also worth
taking your time with.
Installing Software
Once the disk partitions are formatted, you need to select the software
packages you want. The default is kind of ugly I think. Lots of fluff and
the stuff you need to comile from source isn't installed by default. You
may not care about the Open Office suite or sound or video or games, so why
clutter up the disk? If you're installing to a large disk then it won't
matter but if you are installing to a USB thumb drive or small partitions, it matters.
Having a GUI (graphical desktop) is handy, especially if you're just learning
Linux, so install either Gnome or KDE. Go through the whole list of options
for the desktop manager and select or de-select what you think you'll want
(or not).
Do the same in all the other categories. Now go back and do it again. Make
sure you include ntfs-3g so you can talk to your Vista partitions. Include
wicd if you have a wireless connection (see
this). You want the development libraries and tools if you want to
complie from source (install everything if you can). Get the X-Windows
development package so you'll have all libraries.
You'll have to go through all the packages in all the lists to make sure you
get a useable system. It's worth the effort to do as much as possible at
this time to save headaches later. Once all that is done, the actual
installation begins. It takes a while but you'll eventually be prompted to
re-boot. If all went well you'll boot up into your new Linux system.
If you decide to remove software use yum remove or rpm -e
to get as clean an uninstall as possible. If you want to add software try
yum install or rpm -i. If you're feeling amibitious, try
to install from source. Suppose you try to run a program and it complains
about needing some additional package or library. The easiest way is to use
yum or maybe aptget:
yum install glibc -y
yum install python -y
yum install gtk2 -y
This will download, install and add all the dependancies the package
requires. Even better get the yumex add-on for yum and get a
graphical interface. For rpm installs you have to first download the
rpm package and then,
rpm -i package_name
To install from source you have to find the package you want,
download it and
then set it up. Most of these source packages are compressed archives with
a tar.gz or .tgz or .bz2 extension. Download the
file. Next uncompress and unarchive the file:
tar -zxvf package_name.tar.gz
This will create a new directory named for the package. Now cd in to that
directory. Most of the time you'll just execute a configuration script,
./configure
If the script completes without errors you need to compile it and then
install it:
make && make install
If this completes successfully you can now use the package. Any executables
will usually end up in one of /usr/bin, /usr/sbin or
/usr/local/bin. To find the files you have installed:
updatedb
locate some_file
To see what you've installed,
rpm -q | sort
If you've made it this far you have a working Linux system and you're ready
to go. To find out more about actually using Linux, click
here.
Using fdisk
Now that you have a working system, you may want to know how it evrything's
arranged. You should probably start with the fdisk utility to see
how your disk partitions look:
fdisk /dev/hda
This will look at the IDE disk (the "hd" part, the first partition is "a" so
we're looking at hda). It might look kind of like this:
Device |
Boot |
Start |
End |
Blocks |
Id |
System |
/dev/sda1 |
|
1 |
3825 |
30720000 |
7 |
HPFS/NTFS |
/dev/sda2 |
|
3825 |
6375 |
20480000 |
7 |
HPFS/NTFS |
/dev/sda3 |
* |
6375 |
8924 |
20480000 |
7 |
HPFS/NTFS |
/dev/sda4 |
|
8925 |
14593 |
45536242+ |
5 |
Extended |
/dev/sda5 |
|
8925 |
8937 |
104391 |
83 |
Linux |
/dev/sda6 |
|
8938 |
10212 |
10241406 |
83 |
Linux |
/dev/sda7 |
|
10213 |
11232 |
8193118+ |
83 |
Linux |
/dev/sda8 |
|
13447 |
13573 |
1020096 |
82 |
Linux-swap |
/dev/sda9 |
|
13574 |
13828 |
2048256 |
83 |
Linux |
/dev/sda10 |
|
13829 |
14593 |
6144831 |
83 |
Linux |
/dev/sda11 |
|
11233 |
11742 |
4096543+ |
83 |
Linux |
/dev/sda12 |
|
11743 |
13446 |
13687348+ |
83 |
Linux |
Below this is a prompt, "Command (m for help):". If you hit "m"
you'll see:
Command | Action |
a | toggle a bootable flag |
b | edit bsd disklabel |
c | toggle the dos compatibility flag |
d | delete a partition |
l | list known partition types |
m | print this menu |
n | add a new partition |
o | create a new empty DOS partition table |
p | print the partition table |
q | quit without saving changes |
s | create a new empty Sun disklabel |
t | change a partition's system id |
u | change display/entry units |
v | verify the partition table |
w | write table to disk and exit |
x | extra functionality (experts
only) |
Chances are you'll never really change anything but you can at least
see what's currently there and how Linux understands it. Another
way to view how the disk(s) is organized is:
df -h
the df command show disk usage, available space and the
mount point for the various partitions. The "-h" option means to
display the output in an easy to read format (human readable). It
looks like this:
Filesystem | Size | Used | Avail | Use% | Mounted on |
/dev/sda10 | 5.8G | 643M | 4.9G | 12% | / |
/dev/sda9 | 1.9G | 541M | 1.3G | 30% | /home |
/dev/sda11 | 3.9G | 286M | 3.4G | 8% | /var |
/dev/sda6 | 9.7G | 3.1G | 6.1G | 34% | /usr |
/dev/sda7 | 7.7G | 3.2G | 4.2G | 43% | /usr/local |
/dev/sda12 | 13G | 1.5G | 11G | 13% | /files |
/dev/sda5 | 99M | 12M | 83M | 13% | /boot |
tmpfs | 950M | 52K | 949M | 1% | /dev/shm |
gvfs-fuse-daemon | 5.8G | 643M | 4.9G | 12% | /root/.gvfs |
/dev/sda2 | 20G | 4.9G | 15G | 25% | /media/Utils |
/dev/sda3 | 20G | 18G | 1.8G | 92% | /media/Vista |
/dev/sda1 | 30G | 14G | 16G | 47% | /media/Downloads
|
If you want a nice graphical partition viewer that also offers the
capability of managing the partitions, try gparted. The
easiest way to get it is to
yum install gparted -y
To see your mount points from a different perspective try,
mount
You'll see the same information but you can also see the partition
type. Partitions are mounted at boot time using the information in
the /etc/fstab file. You can always mount and
un-mount (umount) a file system by hand if needed but
obviously some file systems can't be un-mounted since they're being
used.
This information is useful is you get odd error messages or you see
something strange in /var/log/messages or from the output
of the dmesg command. It's also handy if you want to edit
the bootloader configuration at /boot/grub/grub.conf.
The more you know about how your system is configured and where
Linux puts things, the easier it is to troubleshoot when things go
wrong. The best tool is your log files, usually in
/var/log so scan them regularly to see what's going on.