Annvix - disks and partitions

Posted in How To's by Shafkat Shahzad, M.Sc - Senior Technical Content Manager on July 31st, 2010

Welcome to the tutorial guide. The tutorial will provided guidance and instructions to users about Annvix disks and partitions.

As we are aware that Linux supports a variety of media as disks including hard drives, floppy drives, zip drives, and USB thumb drives. Each of those drives is referenced by a filename. Typically IDE drives are referenced as /dev/hda and SATA and SCSI drives are referenced as /dev/sda. In a machine with two IDE drives and one SATA drive, they would (most likely) be listed as:
/dev/hda
/dev/hdb
/dev/sda

Hard drives are ordered in the order that they are seen by the BUS and given a two letter designation for their type and a third letter for their order, so hd is an IDE drive and hda is the first IDE drive with hdb the second. The third device could be SATA or SCSI (maybe SAS) but is listed as the only one of this type in this example. CDROM and DVD drives may appear in the same list with a similar designation, but are often also shown with an alias like /dev/cdrom for convenience.

Partitions
Partitions within a drive are also listed in the /dev directory. Typical designations will append a number for each partition within the drive. For instance:
/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda5
/dev/hda6
In this example, the drive has three partitions. Note that they will be displayed this way whether they contain a file system or not. Extended partitions will have a similar designation and so may also appear in the same list, which might lead to confusion for someone who hadn’t read this introduction.
Please note that grub doesn’t show drives the same way.

In the example above, it is likely that /dev/hda1 and /dev/hda2 are normal partitions, while /dev/hda3 is an extended partition that allows the creation and use of /dev/hda5 and /dev/hda6. As an extended partition, it cannot be formatted or mounted, but is still necessary to exist. It is also possible that they are all normal partitions and the slot for {file|/dev/hda4}} is somehow removed.

fdisk
The fdisk is a tool used for managing partitions. This tool allows users to create, delete, relabel and otherwise manipulate their partition table. For most users there are only a couple uses that they need to know. Typically, {prog|fdisk}} should not be used on an installed system while it is booted as a user may remove or modify partitions that are currently mounted and in use. It is possible, however, to manipulate a drive that is not currently in use or to manipulate drives when booted from the Annvix installation CD.
# fdisk -l

Disk /dev/hda: 10.2 GB, 10239860736 bytes
16 heads, 63 sectors/track, 19841 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13563 6835720+ b W95 FAT32
/dev/hda2 13579 14934 682762+ c W95 FAT32 (LBA)
/dev/hda3 14935 19841 2473128 83 Linux
/dev/hda4 13564 13578 7560 5 Extended
/dev/hda5 13564 13578 7528+ 83 Linux

Please note that the partition table entries are not in disk order

Disk /dev/hdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 13 104391 83 Linux
/dev/hdb2 * 14 2434 19446682+ 8e Linux LVM

In the example above, the command fdisk -l is given from the shell and shows the partition tables on all accessible drives. In this example, the first two partitions of the first IDE drive are FAT32 partitions such as those used by some Windows systems.

The third partition is a typical Linux partition, the fourth is an extended partition. The fourth partitions is necessary if a user wants to have more than four partitions. The fifth is another typical Linux partition. This partition warns a user with a notice that the entries are not in disk order, which is a typical for most systems, but can happen if a user rearranges partitions. Notice also the asterisk next to /dev/hda1 and /dev/hdb2. The asterisk indicates that a partition is the default boot partition, which means it will be used to start the boot process.

On the second IDE drive the first partition is a typical Linux partition and the second one is one labeled for use by LVM. Please note that LVM is not typically used for Annvix systems.
A user will also notice the starting and ending sectors used for the partitions as well as the number of blocks each contains.
# fdisk /dev/hda

The number of cylinders for this disk is set to 19841.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)

Command (m for help): p

Disk /dev/hda: 10.2 GB, 10239860736 bytes
16 heads, 63 sectors/track, 19841 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13563 6835720+ b W95 FAT32
/dev/hda2 13579 14934 682762+ c W95 FAT32 (LBA)
/dev/hda3 14935 19841 2473128 83 Linux
/dev/hda4 13564 13578 7560 5 Extended

Please note that the partition table entries are not in disk order

Command (m for help): m
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)

Command (m for help):
Typically a user will need to tell fdisk which disk he/she wants to access as the first argument. This will take a user into a command shell where he/she will be able to issue commands to display and manipulate the system. In this example,the first command issued was p, which simply displays the existing partition table information. When the command completes, the user is returned to a prompt where another command can be entered.

The second command entered in this example is m, which as indicated by the helpful tip, shows more commands that are available. Normal use of fdisk is to create new partitions, label partitions and remove them.

Creating a partition is initiated with the n command. When a user presses n at the prompt, they are given an additional prompt for where to start the first cylinder. The allowable range is displayed along with the default, typically the first cylinder not already in use by another partition as shown here:
Command (m for help): n

First cylinder (13564-13578, default 13564):
If a user needs to leave space between partitions for other allocation or due to damage to the disks then they might use something other than the default, but most users can just hit Enter to accept the default. The next prompt will give the option of how to size the partition:
Using default value 13564
Last cylinder or +size or +sizeM or +sizeK (13564-13578, default 13578):
At this prompt the user can specify the cylinder to end the partition or specify a size and have fdisk approximate the location to accommodate the desired content. Examples of allowable entries for this prompt would be: 13570 for “end the partition on cylinder 13570″ or +30M for a 30MB partition (approximately), or +500K for a very small partition. Gigabytes can be specified as G on most systems as well. The default is to use all contiguous cylinders for the new partition, so pressing Enter will use the rest of the available space on the drive.

After the partition table is created to the desired specifications, the user must use w to save the partition table to the drive. q will leave fdisk without saving changes. d will give prompts to delete a partition. When someone is partitioning a new system, the command to make a partition bootable is b.
If you followed guidance and instructions as provided in this tutorial guide then you would have learnt about the disks and partitions.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment