04 – Preparing Your Hard Disk
December 5, 2009 – 10:16 pmPlease note… This information no longer exists at the referenced locations. This is only a copy of what was available in 2003.
Basic Linux Training™
Preparing Your Hard Disk
Diane Labrosse
Table of Contents
- How Much Hard Disk Space?
- Prune
- Backup
- Scandisk
- defrag
- DOS Format Floppies
- Create an Emergency DOS Boot Diskette
- Create an FIPS Floppy
- Create a BOOTDISK
- Create a ROOTDISK
- Assignments
How Much Hard Disk Space?
Ideally, you would install Linux on it’s own hard disk. Most of us are not that lucky, so you will have to create a partition for Linux on the hard disk you’re currently using for DOS/Windows. Since the operating systems are contained on separate partitions, DOS/Windows will treat the Linux partition as a separate drive, and they can peacefully co-exist on the same computer. In fact, Linux can access all the files on a DOS/Windows partition, and through an emulation program, such as WINE or samba, run Windows programs.
You’ll need at least 150 MB of free space for a really useful minimal Linux installation, and upward of 450 MB if you intend to load most of the command line software – such as the compiler and programming tools, kernel source, and have a comfortable margin for additional programs later. These numbers are higher than those given in the textbook, written when hard disk storage space and RAM were both much higher priced than they are today, and before large GUI applications and suites of programs like gnome and KDE (if you’re going to try either of these, you better plan on an additional 100-150 MB – each – as a minimum). With the drastically reduced price of hard disks (40 GB or larger seems standard on most new models), trying to squeeze Linux into as small a space as possible is no longer a requirement for most users or developers. (Also note that for a ‘complete’ installation of everything, you’ll need at least 4.5 to 6 GB just for the OS and applications!
You’ll need a swap partition (if you have less than 16 MB RAM) to act as virtual RAM. Unfortunately, the swap partition can be used only for swap space. The old rule of thumb of adding swap space to total 16 MB including physical RAM probably needs to be more like ‘totaling 32 MB’ and more like ’64 MB’ or even ’96 MB’ if you have enough slots for additional RAM. Swap is never going to be as fast as physical RAM, so if you have available slots on your motherboard, I suggest you fill them with as much RAM as you can afford while RAM is still cheap.
If you have more than 32 MB RAM you may not need a large swap partition; physical RAM plus your swap partition should total at least 64 MB, and probably more like 96MB. You can always add an additional swap file if you have a particular need, then delete it and continue as you were before.
You take a performance hit by not having a swap partition at all, but it can be done – I ran for over a year without one and rebuilt the kernel twice without too much inconvenience. However, be aware that you can crash and lose all data in buffers without giving the OS the resources it needs to do it’s various jobs during a normal shutdown.
Since the swap partition is limited to 128 MB, you can have more than one swap partition – up to 16 – and many sysadmins routinely carve out a 128 MB swap partition on each hard disk, which seems to work fine, particularly with RAID and SCSI disks.
You may want to set up more than one Linux partition. For example, /, /usr, /home. There are a number of advantages in doing this – you have better security because damage to one partition will be insulated from the others, other than damage to the MBR, of course; upgrades are much easier to do, especially with Slackware, and so are backups. Remember, though, that the Intel x86 series of microprocessors (not the OS) limits you to 4 primary partitions, and that the numbering for logical (extended) partitions always begins with 5 regardless of how many primary partitions you have.
The bulk of your hard disk should be devoted to /usr, with most of your programs added there. Something like the following is practical for a modest 250 MB installation:
- / – 60 MB
- /usr – 180 MB
- /home – 10 MB
That may or may not be practical for your situation, so read the HOWTOs and if you need to – repartition. (Mistakes are all part of the learning process. Questioning and revising is what science and technology are all about.)
Remember, also, that the X Window System alone will run over 55 MB (in /usr/X11R6) and your kernel source code will run over 25 MB (in /usr/src).
On the other extreme, with very large hard disks, you’ll run into another problem with the BIOS – the 1024 cylinder barrier. This is easily disposed of if you put all of the boot loader mechanism below 1023 (in /boot) – which may require a small partition (5 to 10 MB) specifically to get around this problem.
Version 21.3 of lilo eliminates this barrier entirely, and current releases for all distributions will include this!
Keep notes of everything you do – particularly the partition table when you run fdisk as you set up your partition(s) for Linux during the initial installation. If something should go wrong, write down the error messages. This will prove invaluable with getting help with troubleshooting. Should you need to restore to the previous settings, from DOS you can run
C:\> fdisk /MBR
Prune
If you have plenty of hard disk space to devote to Linux you can skip most of these procedures, except the backup.
Prune your drive; delete programs you never use, all the shareware and zip files, old e-mail and newsgroups messages (or move them to floppies if you want to save them).
Backup
The executable programs on your computer should have installation floppies or CD-ROM, so, basically, you need to concentrate on backing up your configuration files (autoexec.bat, config.sys, win.ini, system.ini, etc.) and your data files (anything you have created), as well as any additional software that you have added, do not have on CD-ROM or floppy, and want to keep.
Scandisk
As you used your computer, you’ve added files, edited files, deleted files. Over time your hard disk has become fragmented – in other words, the files are not necessarily contiguous and probably look like Swiss cheese. We’ll deal with this in a moment, but a related problem is that the record of where those bits and pieces which have been scattered around on the hard disk may contain errors – these are called ‘lost chains’ since the reference to the next link in the chain has been deleted.
First, you need to make sure that the data location recorded in your Master Boot Record is in sync with where the data is actually located on your hard disk. Scandisk is a non-destructive utility that can be run in either DOS or Windows for this. (If you are prompted whether to save these lost chains to file, answer ‘no’ – otherwise your root directory will be cluttered with a lot of junk you’ll end up deleting anyhow.) Scandisk can be run from the the System tools in Windows Accessories or from an MSDOS command line. If you are working on an older version of DOS you will need to run chkdsk as follows:
C:\> chkdsk/f
The /f switch fixes the lost chains.
defrag
As you add programs or edit files, they will be stored in the next available space on your hard disk, and over time your hard disk will be fragmented – as opposed to being contiguous, part may be stored in one location and part in another. Then as files are deleted, your hard disk has gaps in it; this is fragmentation.
Before you run the defragmentation utility, temporarily delete your Windows swap file also. This utility is found in the System tools in Accessories. In older versions of DOS, it is run from the command line as follows:
C:\> defrag
The next time you start Windows, you’ll be reminded that the swap file has been corrupted, and asked whether you want to delete the corrupted file – answer yes, and reset your swap file before you do anything else.
DOS format Floppies
To resize your partition you will need at least 3 floppies. They will be for an Emergency DOS Boot disk, a disk for fips and another disk for a copy of your Master Boot Record on it (in case you need to restore it). If you cannot boot from the CD-ROM, you will need two additional disks a bootdisk and a rootdisk. If your CD-ROM does not boot, be sure to first check the BIOS Setup to see if it is listed first in the boot order. To get into the Setup boot the computer and watch for a message that says something like “To enter Setup press F1.” The key may be DEL or some other key. Once in Setup look for something about the boot order and put CD-ROM first. Save the Setup and you should be able to boot from the CD-ROM. If your CD-ROM is not supported by the installer you will still need to use the two special floppies. After you install you can set the boot order back to what it was before you changed it.
C:\> format a: /u
This is an unconditional format; if you’re using fresh, pre-formatted floppies, you can skip this step (or use /q instead of /u for a quick format just to be safe). (These floppies are crucial so I don’t recommend reusing an old floppy for any of them; use ‘virgin’ floppies that have never had anything else on them.)
Create an Emergency DOS Boot Floppy
Make a DOS bootable floppy if you don’t have one already:
C:\> sys a:
You’ll also need to copy some additional DOS utilities to this disk; e.g. format, fdisk.com, system.com, restore.com, etc. (any DOS utility that you may need to work some quick fix in case your system goes down and you have to boot from a floppy). Label this first floppy Emergency DOS Boot, and date. Boot with it to test it.
Create a FIPS Floppy
What follows is the basics of running FIPS. FIPS works on FAT or FAT32 primary partitions. It will not work on NTFS or extended or logical partitions. In order to resize those partitions you will need to get Partition Magic. Version 7 will work on NTFS partitions used in XP.
FIPS can be found in the dosutils section on the CD-ROM of most distros. If you don’t find it on the CD-ROM, the latest version is at http://www.igd.fhg.de/~aschaefe/fips/. Use version 2.0 and read and printout fips.doc before running it. It’s good to print it out, because you may need to read those instructions while you are unable to access your computer. Follow the instructions to the letter. The instructions here are meant only to give you an idea of what resizing your partition is about, but these instructions are not complete.
Make the second floppy bootable as you did the first one. Copy the FIPS files FIPS.EXE, RESTORRB.EXE, and ERRORS.TXT to this disk. Label this diskette FIPS, and date. Try booting with it to see if it boots. You will run FIPS from DOS and not from a little MSDOS window in Windows.
A third DOS formatted floppy will be needed later to save a copy of your MBR during the process of running FIPS. This will be needed to put things back like they were before running FIPS if it becomes necessary.
Assuming you have read the fips.doc and have a copy in case you need it in a hurry, you should be ready to run fips and divide your FAT32 partition into two primary partitions – one with your untouched Windows installation still on it and the other one ready to delete to make space for some Linux partitions.
Create a BOOTDISK
If the installation program boots from your CD-ROM, you will not need the bootdisk or rootdisk. If you need them there are a number of options, but for our example here we will be using the bare.i for IDE; you will have to use the one which is appropriate for your specific hardware. rawrite ¹ the bootdisk on the third floppy. Label this diskette Bootdisk and date.
E:\BOOTDISKS.144> rawrite bare.i a:
Which boot disk to use depends on your CD-ROM; first go to the directory for the size of your floppy drive (1.2 or 1.44). All IDE boot disks (.i) support IDE hard drives and CD-ROM drive plus the additional drivers listed; all SCSI boot disks (.s) have full SCSI support plus the additional drivers listed; choose the image with your CD-ROM and the least number of other drivers.
If you’re confused by the listings, find one that has your CD-ROM listed and use the extension for whether your hard drive is IDE or SCSI.
¹ – rawrite does a block by block transfer, you can NOT substitute DOS copy. (Some distributions use rawrite2.)
Create a ROOTDISK
You will use this floppy to boot your computer with the Linux operating system, rather than DOS, to install from the CD-ROM. There are a number of options depending on how you want to do your installation; for this example, we will be using a colorized installation program and installing from CD-ROM. rawrite the rootdisk on the second floppy. Label this diskette Rootdisk and date.
E:\ROOTDISKS> rawrite color.gz a:
Assignments
Terms and Concepts:
Define and add these to your glossary:
- cylinder
- master boot record (MBR)
- partition table
- repartition
- format
- rawrite
On-line:
NOTE: As you begin extensive reading of the LDP HOWTOs and mini-HOWTOS, bear in mind that they were written by many different people with different writing styles and communications skills. Some of these documents are very easy to read and understand, others are not. There will necessarily be a lot of repetition, but the information you need is there.
- http://www.tldp.org/HOWTO/Installation-HOWTO/ – Linux Installation HOWTO
- http://www.tldp.org/LDP/gs/gs.html – Installation and Getting Started Guide
Depending on your distribution, you might also want to check the Linux Gazette archives for additions to the Installation and Getting Started Guide for your distribution:
http://www.ssc.com/lg/ – Linux Gazette.
- Debian – issue 15, Linux Gazette
- S.u.S.E. – issue 16, Linux Gazette
- Slackware – issue 17, Linux Gazette
- Red Hat – issue 18, Linux Gazette
Various LDP HOWTOs and mini-HOWTOs at:
http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
- This is one of the most important documents in all Linuxdom! -
Keep updating this file at least monthly because the documents are constantly being revised and new ones coming on-line that you may need.
Some of the most useful at this stage are:
- CD-ROM HOWTO,
- Boot Prompt HOWTO,
- Bootdisk HOWTO,
- SCSI HOWTO (unmaintained)
- UMSDOS HOWTO
and from the mini-HOWTOs:
- Large Disk mini-HOWTO (if applicable),
- Loadlin+Win95/98/ME mini-HOWTO,
- Partition mini-HOWTO.
and the appropriate mini-HOWTOs, especially those with your operating system(s) in the title.
You can also find tens of thousands of additional Linux related sites through http://www.google.com/linux which – as the subdirectory indicates – is 100% Linux-related webpages and sites.
There are also hundreds of websites with ‘Linux’ in the domain name. You’re on one right now
Examples appropriate to the topic at hand are http://www.linux-backup.net/
and http://kmself.home.netcom.com/Linux/FAQs/backups.html among others.
Copyright © 1997-2003 Henry White. Copyright © 2003 Diane Labrosse. All Rights Reserved.
Reproduction or redistribution without prior written consent is strictly prohibited. Address comments and inquiries to info@basiclinux.net.
Sorry, comments for this entry are closed at this time.