dcsimg




Getting Your Disk Drive Ready for Linux

People often say that Linux is difficult to install. One reason for that view is that most lack experience installing operating systems. As those of us who have tried can testify, every operating system is difficult to install -- including Microsoft Windows. Today, few people actually install Windows, as it comes pre-installed. If most computers had Linux pre-installed, then people would complain about the difficulty of installing Windows.

People often say that Linux is difficult to install. One reason for that view is that most lack experience installing operating systems. As those of us who have tried can testify, every operating system is difficult to install — including Microsoft Windows. Today, few people actually install Windows, as it comes pre-installed. If most computers had Linux pre-installed, then people would complain about the difficulty of installing Windows.

Nevertheless, it is difficult to install Linux. It’s particularly difficult to install Linux alongside Windows in a so-called dual-boot configuration, which is perhaps the most common configuration. One of the most challenging problems facing the would-be Linux user is properly preparing the disk drive to leave space for both operating systems. In this column, we hope to explain why this is such a difficult problem and tell you how to overcome it. Let’s start by looking at how disk drives are organized.


Disk Drive Boot Camp

To comprehend a disk drive, first try visualizing a tree — this would be the botanical variety rather than the computer science variety. If you cut a thin cross-section of a tree trunk, the result resembles a very large CD-ROM. If you look closely at the cross-section, then you would notice concentric annular growth rings resulting from the seasonal cycle.

A disk drive contains several specially coated metal platters, each resembling such a cross section. The tree’s growth rings are analogous to cylinders of the disk drive. In a disk drive, each cylinder is divided into sectors, each of which has a fixed size, often 512 bytes. When data is written to, or read from, the disk drive, it is generally written or read one sector at a time.

The cylinders of a disk drive and the sectors within a cylinder are each numbered from 0. Therefore, the location of any sector on the drive can be designated simply by the number of the containing cylinder and the number of the sector itself.

Disk drives are divided into units known as partitions, which occupy a contiguous range of cylinders. You can think of partitions as the watertight compartments of a ship, which help contain flooding that might otherwise result in the loss of the ship. If data in one partition become corrupt, other partitions are not affected. But, if the corrupt partition contains important operating system files, the system itself may be unbootable. A disk drive can contain as many as four ordinary partitions, which are referred to as primary partitions.

To overcome the four-partition limit, it’s possible to designate one partition as an extended partition. An extended partition can contain many logical partitions, which can generally be used in the same way as primary partitions; however, it’s rare for an extended partition to contain more than a dozen logical partitions.









feedback



       page 1 2 3 4   next >>

 

Linux Magazine /
December 2001 / NEWBIES
Getting Your Disk Drive Ready for Linux





At any time, one primary partition can be designated as the active partition; when the system is booted, the operating system residing on the active partition is given control. The master boot record (MBR), which is used in booting the system, resides in the first cylinder of the disk drive, beginning in the first sector.

The active partition contains additional, special information called a boot record in its first cylinder. Whenever the system is booted, the master boot record fetches additional information from the active partition’s boot record.

Each partition has an associated numeric code called the partition type, which is specified when the partition is created. Some of the most common partition types are given in Table One




Table One: Common Partition Types









Hex CodePartition Type
00 Empty
05 Extended
06 Microsoft FAT16
07 Microsoft NTFS
0b-0e Windows 95 FAT32
82 Linux swap
83 Linux

Generally, a partition must be formatted before it can be used. Formatting a partition creates a filesystem, which is capable of storing data. (Swap partitions, which are used to augment system RAM, need to have mkswap run on them before use.)

There’s a lot more to be said about disk drives, partitions, and file systems. A good source of additional information is the Linux Partition HOWTO by Tony Harris and Kristian Koehntopp (http://www.linuxdoc.org/HOWTO/mini/Partition/index.html).

Partition Requirements

So, why are partitions a headache for the would-be Linux user? In principle, a Linux system requires only a single partition. Depending on the files and packages that the user wants the system to contain, the partition must be at least 300 MB to 1,200 MB in size. Realistically, the partition should be at least 2,000 MB.

However, the BIOS of most PCs cannot access data stored beyond cylinder 1023 of a disk drive. This is true even of some PCs that claim to be free of this restriction. Therefore, the Linux boot files — including the Linux kernel — should reside within the first 1024 cylinders of the disk drive on which they’re stored. If any part of the Linux partition extends beyond cylinder 1023, it’s possible that one or more boot files may be inaccessible. Making matters even worse, it is possible for disk writes to cause a boot file that was initially stored in an accessible location to move to an inaccessible location, thereby causing the system to become unbootable.

To avoid this problem, it’s customary to create a special Linux boot partition mounted on /boot that’s wholly contained within the first 1024 cylinders of the disk drive. This partition can be relatively small since only about 16 MB are needed. Andries Brouwer’s Large Disk HOWTO (http://www.linuxdoc.org/HOWTO/Large-Disk-HOWTO.html) will provide more information on this topic.

In addition to the main Linux partition and the boot partition, it’s customary to create a third partition — the Linux swap partition, which is used as virtual memory. Although Linux can technically operate without a swap partition, it operates much more efficiently with one.

As a rule of thumb, the Linux swap partition should have a size equal to twice the installed system RAM; however, regardless of the size of your system memory, the swap partition should be at least 128 MB and should not be larger than 2,000 MB.

To summarize, three Linux partitions are customarily created:

  • a boot partition (type 83) having a size of 16 MB, contained within the first 1024 cylinders
  • a boot partition (type 83) having a size of 16 MB, contained within the first 1024 cylinders
  • a main partition (type 83) having a size of 2000 MB or more
  • a swap partition (type 82) having a size which is twice that of the installed system RAM

You will ordinarily need to reorganize your disk drive so that it’s possible to create all of these partitions.








feedback



<< prev   page 1 2 3 4   next >>

 

Linux Magazine /
December 2001 / NEWBIES
Getting Your Disk Drive Ready for Linux




Step One: Backup Your Disk Drives

Before reorganizing your disk drive, you should back up your system. Unless you’re confident that you’ll make no mistakes and that your tools will work perfectly (in other words, unless you are supremely overconfident — a guaranteed recipe for disaster), it’s important that you back up every disk drive, not merely the disk drive you plan to reorganize.

You can use a backup utility included with your operating system, such as Microsoft Backup or the tar command. However, you may find it more efficient to use a utility that is designed to create an image of an entire disk drive. Table Two summarizes some useful backup utilities. Of course, you’ll need a backup device attached to your system, such as a CD-R, CD-RW, Iomega Zip or Jaz, or a network drive.




Table Two: Some Useful Backup Utilities





UtilityTypeURL
Norton Ghost Commercial http://www.symantec.com/sabu/ghost/ghost_personal
Partition Image for Linux Open Source http://www.partimage.org/
PowerQuest Drive ImageCommercial http://www.powerquest.com/driveimage

Installing Linux to an Empty Disk Drive

The simplest way to deal with the problem of organizing your disk drive for Linux is to start with an empty disk drive. If you’re willing to simply delete all of the existing partitions from your PC’s disk drive, then your Linux distribution’s installation procedure should have no difficulty establishing the proper Linux partitions.

However, by deleting the existing partitions, you lose the data they contain and blow away the installed operating system. This is rarely a good idea; nevertheless, many people who install Linux on an older, unused PC are willing to take this route.

If you’re unwilling to part with your existing data and operating system, you may be able to install a second disk drive and install Linux to it. Installing a new disk drive for running Linux provides plenty of disk space for installing a wide variety of packages and programs.

Most computers have two disk controllers — a primary and secondary controller — and are capable of booting from either of two disk drives associated with the primary disk controller. If your system includes a CD-ROM drive, you may need to reconnect it to the secondary disk controller so you can connect the new disk drive to the primary controller. If you’re not comfortable working with hardware, most computer stores will install a disk drive for about $50. Be sure you instruct the store’s technician to connect the new disk drive to the primary disk controller.









feedback



<< prev   page 1 2 3 4   next >>

 

Linux Magazine /
December 2001 / NEWBIES
Getting Your Disk Drive Ready for Linux







Reorganizing a Drive by Using FIPS

Many veteran Linux users originally prepared their disk drive for Linux by using an open source utility named FIPS. Red Hat, for example, includes the FIPS utility as part of its Linux distribution.

FIPS lets you split a single partition into two partitions, one of which is created from free space at the end of the original partition, which shrinks in the process. For FIPS to be useful, the original partition must contain free space equal to the size of the desired Linux partition, generally 300 MB to 2,000 MB.

However, FIPS has some limitations that preclude or can hamper its use by many contemporary, would-be Linux users:

Consequently, I don’t generally recommend FIPS as a method of preparing a disk drive for Linux. However, if you suspect that FIPS might work for your system, be sure to see the FIPS documentation provided as part of your Linux distribution or visit the FIPS Web site at http://www.igd.fhg.de/~aschaefe/fips/.

Other Tools for Preparing a Disk Drive

Unless you insist on open source and refuse to use commercial software, PowerQuest’s PartitionMagic ($70) http://www.powerquest.com/partitionmagic) is the easiest and best way to prepare your disk drive for Linux. (Please note that I have no financial interest in PowerQuest; I’m merely a very satisfied customer.)

PartitionMagic can create, resize, split, move, and merge partitions. It has an easy-to-use graphical user interface that lets you drag and drop partitions. It runs under Windows or from a boot floppy you create when you install it. It makes it easy to resize a Windows partition to obtain free disk space and move the resulting partition to create a place for Linux boot, main, and swap partitions.

The Red Hat Linux distribution includes Disk Druid, which enables you to create and delete partitions; however, it does not let you resize or move them. Similarly, Mandrake Linux includes DiskDrake, which enables you to create, delete, and resize partitions; however, it does not allow users to move them.

GNU Parted is an open source program that enables you to create, delete, resize, and move partitions. Parted has a text-based user interface and can be run from a boot floppy. For more information, see http://www.gnu.org/ software/parted/.

PartitionStar is a commercial program that enables you to create, delete, resize, and copy partitions on your hard drive. The program runs under Windows or DOS. It has a graphical user interface and costs only $10. For further information, see http://www.star-tools.com/english/.

Ranish Partition Manager is an open source program that enables you to create, delete, and resize partitions. It has an associated Advanced Boot Manager, which is compatible with Windows 9x/NT/2000 and Linux. For more information, see http://www.users.intercom.com/~ranish/part/.

Overcoming the Challenge

Preparing your disk drive for Linux can be a challenge. Most Linux distributions and traditional utilities (such as FIPS) offer only incomplete solutions to potential problems. However, by installing a new disk drive or using a full-featured tool such as PartitionMagic, you can generally avoid most of the pain and frustration. Until next month, happy partitioning!


Bill McCarty is an associate professor at Azusa Pacific University. He can be reached at bmccarty@apu.edu.







feedback



<< prev   page 1 2 3 4       

 

Linux Magazine /
December 2001 / NEWBIES
Getting Your Disk Drive Ready for Linux






Comments are closed.

Software
 Stick a Fork in Flock: Why it Failed
 CentOS 5.6 Finally Arrives: Is It Suitable for Business Use?
 Rooting a Nook Color: Is it Worth It?
System Administration
 Scripting, Part Two: Looping for Fun and Profit
 Command Line Magic: Scripting, Part One
 Making the Evolutionary Leap from Meerkat to Narwhal
Storage
 Extended File Attributes Rock!
 Checksumming Files to Find Bit-Rot
 What's an inode?
Mobile
 Putting Text to Speech to Work
 Look Who's Talking: Android Edition
 Upgrading Android: A Guided Tour
HPC
 A Little (q)bit of Quantum Computing
 Emailing HPC
 Chasing The Number