|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
| HOW-TOs | Man Pages | FAQ | |||||
FDISK(8) Linux Programmer's Manual FDISK(8)
NAME
fdisk - Partition table manipulator for Linux
SYNOPSIS
fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device
fdisk -l [-u] [device ...]
fdisk -s partition ...
fdisk -v
DESCRIPTION
Hard disks can be divided into one or more logical disks called parti-
tions. This division is described in the partition table found in
sector 0 of the disk.
Linux needs at least one partition, namely for its root file system.
It can use swap files and/or swap partitions, but the latter are
You can use the fdisk or parted commands to create the appropriate partition sizes in the disk. To display the partition table, use the fdisk -l command. Refer to the man pages for the fdisk and parted commands for more information.
| Disk partitoning task | Solaris | Linux |
|---|---|---|
| Create partitions on the disk | format or fmthard | fdisk or parted |
| Display partition table | prtvtoc | fdisk or parted |
| Maximum usable partitions | 7 | 15 for SCSI, 63 for IDE |
| To create a file system on disk | newfs or mkfs | mkfs, mkfs.ext3, mk2fs -j, parted, or mkfs.reiserfs (SUSE only) |
| Check file system for consistency | fsck | fsck, fsck.ext3, e2fsck |
In Solaris, you can create and use a maximum of seven slices per disk excluding the WholeDisk slice number 2.
In Linux, we have primary partitions and logical partitions contained in (primary) extended partitions.
Primary partitions and extended partitions can be created only in the Master Boot Record (MBR) of the disk and there is room for only four such partitions in MBR. Logical partitions are partitions created in extended partitions on the disk. The extended partition cannot be used directly, but only by means of the logical partitions created in it. To summarize, we can have up to four primary partitions, or one extended partition and up to three primary partitions defined in the MBR.
Using either the fdisk or parted command, you only need to create primary and logical partitions, and they then make the extended partitions automatically.
Another thing to note is that, in Linux, each partition has a partition type, which describes its intended usage. This type can be Linux, Linux LVM, Linux RAID, and so on. When creating a Linux partition, you decide what partition type to use. This depends on for what you intend to use the partition. If it is for data file system data storage, you will have to select ext2, ext3, Reiserfs, LVM, or one of the other options available. Refer to the man pages for the fdisk and parted commands for more information. The interactive fdisk command displays the available partitions types when you use the l subcommand.
# prtvtoc /dev/rdsk/c0t1d0s2
* /dev/rdsk/c0t1d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 424 sectors/track
* 24 tracks/cylinder
* 10176 sectors/cylinder
* 14089 cylinders
* 14087 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 1058304 20972736 22031039 /
1 3 01 0 1058304 1058303
2 5 01 0 143349312 143349311
3 8 00 22031040 121308096 143339135 /space
7 0 00 143339136 10176 143349311
# fdisk -l
Disk /dev/sda: 9100 MB, 9100369920 bytes
255 heads, 63 sectors/track, 1106 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 64 514048+ 82 Linux swap
/dev/sda2 * 65 1106 8369865 83 Linux
Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: May 06, 2008