In
the following article, I refer to the GNU/Linux OS and various FOSS
projects under the catch-all name of "Linux". It just scans better. . .
Getting started with Linux
It's not surprising that the
first question many Linux wannabe-users ask is "What
distro should I use?" - Linux
has a bewildering array of choices for almost every task, and your
first concern is to get it right with your distro choice.
Isn't it?
Well, actually. . . No. IMHO,
there's another question that should come first. It's the question of
your hard drive. Another common question from those who are about to
take their plunge into the world of the penguin: "How should I
partition my hard drive?" Most of the time, they'll be answered by
people who will helpfully explain how to carve up their disc.
Most of the advice I've ever
seen given, however, has been bad. Mainly because it's always assumed
that partitioning is a secondary concern that comes after choosing a
distro. This mistake has serious knock-on consequences down the road.
So, here is how I
think:
Before you can install any
Linux distro, you must first make room for it on your hard drive. A
full installation can be quite big, but you're mostly going to expect
2GB to be enough for the basic system. In these days, it's hard to buy
a hard drive smaller than 40GB, so you should have no trouble finding
room. However, what partitions should that space be split into?
Well, here's the golden rule.
This is the single most important piece of advice I can give you when
it comes to your first ever Linux install, so if you take nothing else
away from this page, take this: Leave
as much of your hard drive unpartitioned as possible.
This is where everybody goes
wrong. They think . o O (I
have 100GB free hard drive space, therefore I need to create 100GB of
partitions to put my 2GB Linux distro on.)
No! Leave that space alone!
Partitioning your whole hard
drive at once leads to huge problems later on. Your chances of getting
exactly the right scheme first time are zero, no matter how many people
give you advice. You'll have distro problems, space problems, upgrade
problems, all kinds of problems. To keep your PC as flexible as
possible, base your partitioning scheme on what you NEED, not on what
you HAVE.
With this philosophy in mind,
here is how you should approach partitioning. You will need:
- A swap partition. The same
size as your PC's RAM. The old rule of thumb of double is outdated.
These days, swap is almost unused, but it's good to have some. It
should be the first partition you make, as this puts it in the center
of the hard drive where read/write times are fastest.
- A /boot
partition. This is where your Linux kernel lives, and also where your
boot loader files may live. Sharing /boot
makes multiple-distro installs easy. /boot
doesn't need to be big. Make it 50MB, no more. Less if you like. Make
it ext2 - you don't need a journalling system for such a small
partition, especially one that's usually only read during bootup.
- A /home
partition. This is where the files of ordinary users will live. You
want a shared /home
for two reasons: It means an ordinary user can't meddle with any part
of the root filesystem's partition; and it allows you to share your
files across distros. /home
only needs to be a GB or so, unless you have a convincing need to
enlarge it. Use a journalling filesystem such as Ext3 or ReiserFS for
this partition.
- Lastly, a /
partition. This is where all your packages will go to give you a fully
working distro. Take a look at the system requirements, which will
probably call for 2GB. Add another GB or two for easy expansion if you
have the space. Format it with another journalling filesystem.
That should add up to a
single-digit number of GB used up for your total Linux system. This
leaves you with a number of GB free, which you can use later to expand
your partitions, add new partitions, or add new Linux distros.
I hope now you see why I place
such value on leaving disk space free. It turns hugely important
problems into trivial inconsequentialities. It no longer matters if you
need to change your partitioning scheme, there's plenty of room to do
so. It no longer matters if you choose the wrong distro, there's plenty
of room for a new one. You still have enormous flexibility even after
you've done all your installing.
So, now that we've sorted out
the really important problem, let's move on to the trivial one: What
distro to use?
Well, that all depends on what
you really want a distro to do. Slackware, Gentoo, LFS, all are good
choices if you want to really get in and learn how Linux works, but
have steep learning curves. Fedora, Suse, Mandriva, these are all good
choices if you want an up-and-running distro as soon as possible.
Debian is a good all-rounder. They're all free, why not download and
install several? You've got plenty of disk space to use! Why not
install Slackware, Debian, and
Suse and have a play around with each one?
If you like the idea of having
a go with several distros, you need to know:
- The /boot
and swap partitions should be universal, and the /home
partition can be if you're careful. You need to check the /etc/password
file to make sure your user has the same numerical ID on each distro
before /home
will be shareable.
- The file /etc/fstab
is the one that tells your PC which partitions to mount, and where. The
/boot
and swap (and possibly /home)
entries should be the same in each distro's fstab. Only /
will be different.
- The Lilo bootloader
configuration file lives in the /etc
directory, which is not shared. The Grub bootloader's files live in /boot,
which IS shared. Install Grub for a multiboot system, as you can update
it from all distros, instead of having one Lilo-controlling distro.
- If you're multi-booting with
Windows, you may want to create a FAT partition to transfer files
between it and Linux. Linux isn't too good at NTFS and Windows is
useless at anything Linux. FAT is the only common ground.
- You can only have four
primary partitions. This is very limiting. Instead, use as few primary
partitions as possible and stick to logical partitions as much as
possible.
- The /etc
directory is where most of the configuration files live. If you get one
distro set up the way you like, and then want to switch, carefully and
intelligently copying information across from /etc
can save you a lot of setting up time. But under
no circumstances should you
simply copy the entire old /etc
directory to the new one: This is a recipe for utter disaster. Do it
manually, bit by bit, or not at all.
- Finally, the command df
-h will show you how full your
partitions are getting. If one starts getting full, either enlarge it,
or split it into multiple partitions. The safest way to make a
partition bigger is to have a complete working backup of it, easy to do
if you have free partitioning space. My recommended method is:
- Create a new partition
(From now called $DEST) at the end of the free space, not the
beginning. Make it the same size or slightly larger than the partition
you want to enlarge (From now called $SOURCE). Format it with the same
filesystem as $SOURCE.
- Unmount $SOURCE or boot
in to a different distro if it's the /
partition
- Create /mnt
directories, /mnt/source
and /mnt/dest
- Mount $SOURCE on /mnt/source
and $DEST on /mnt/dest
- cd /mnt/source
- To copy all files with
permissions and ownership etc intact, use cp
-Rav * /mnt/dest
- Go get yourself a
coffee. . .
- When it's done, unmount /mnt/source.
If $SOURCE was not the /
partition, mount $DEST at $SOURCE's usual mount point and check it's
okay. Skip to step 12
- If $SOURCE was
the /
partition, go into /mnt/dest/etc/fstab.
Edit it appropriately, with $DEST as the /
partition.
- cd
/boot/grub, and duplicate the
$SOURCE entry in grub.conf,
edit the name to "Duplicate" or some such, and edit the root partition
entry to point to $DEST
- Reboot into the new
$DEST, check everything copied across okay.
- If copying didn't work
properly, redo from start. If it did, you can now safely resize the old
partition, or delete it and create a new & bigger one. If
resizing succeeds, you're done. If it doesn't, or you went with "Delete
and Create New", repeat the above instructions to put the $DEST files
into the new and larger $SOURCE partition. This done, you can delete
the $DEST partition and enjoy your bigger and better $SOURCE partition.
(This
set of instructions based on the LinuxFromScratch hint Creating
a functioning duplicate of a finished LFS system)
This concludes my advice on how
to get started with Linux. I hope you found it helpful.
If you have any feedback, good
or bad, about this article, mail
me.
This
work is licensed under a Creative
Commons License. This page's URL
must be supplied in attribution.