Stable version to be found:

And other formats as well (may be) on the Stable HOWTOs page

If necessary use the Discussion page to give comments.

Discussion Page Content if any

Partition-Mass-Storage-Tools-HOWTO, copyright (c) 2009 Jean-Daniel Dodin

Licence

      Permission is granted to copy, distribute and/or modify this
      document under the terms of the GNU Free Documentation License,
      Version 1.2 or any later version published by the Free Software
      Foundation; with no Invariant Sections, no Front-Cover Texts and
      no Back-Cover Texts.  A copy of the license is included in the
      section entitled "GNU Free Documentation License".

GNU Free Documentation License

Mass Storage Involved Here

See here The details of the kind of mass storage involved here, basically hard drives and flash memory.

Partitioning Programs

General Notes

Be aware than many partitionning programs are called "fdisk" but have no direct relation between them. There is a Linux fdisk (in fact two :-(), a Windows fdisk, an OS/2 fdisk and at least a Mac fdisk, not to mention *BSD fdisk.

The basis is to use the fdisk that go with the operating system that is to use the partition. Create Windows partitions with the Windows fdisk, the Linux partition with the Linux fdisk and so on.

The reason is simple: what ever you try you never can know what is hidden under a proprietary program. Nobody can know what is hidden under Windows fdisk and may popup in unexpected manner. A proprietary fdisk can make a change in the partition layout or content that is on some occasion needed by the corresponding OS. For example, early MS-DOS fidsk did not only change the partitions, but as well reset the FAT (File Allocation Table - that is the file list), so any use of MS-DOS fdisk made the files unavailable.

However, of course, a proprietary fdisk can disturb the others partitions (Linux, Mac...) on the same disk and why not on an other disk. This kind of feature, though, should be found very fast and documented.

That said, GNU parted pretends to be able to partition a disk for any existing operating system and is likely to do so. So use what option fits better your needs.

GNU Parted

According to http://www.gnu.org/software/parted/index.shtml:

"GNU Parted is an industrial-strength package for creating, destroying, resizing, checking and copying partitions, and the file systems on them. This is useful for creating space for new operating systems, reorganising disk usage, copying data on hard disks and disk imaging."

Simpler way to use parted is command line. Assuming the drive to partition is /dev/sdb:

parted /dev/sdb1
GNU Parted 1.8.8
Using /dev/sdb1
Welcome to GNU Parted! Type 'help' to view a list of commands.

I wont copy here the parted documentation. It's mostly in info format, so info parted gives you the doc.

But you can simply do what is said and type help on parted itself. If you do so (do it!) you will see that parted is not only a partitonning tool, but also can create file system, copy file systems and resize partitions, on the beginning.

If you run parted in an xterm, remember you can resize the window to fit the help lenght :-).

Parted is not a programm for everybody, so I wont give many infos here. For example, commands are immediately executed (remove a partition and the partition is immediately removed, fore example), what is very dangerous.

fdisk

Notes

As already said, usual partition editor have for name fdisk. We are only to speak about Linux fdisk. There are at least three nearly identical fdisk on Linux, GNU fdisk (http://www.gnu.org/software/fdisk/), based on parted, the kernel fdisk with no home page but a ftp (ftp://ftp.kernel.org/pub/linux/utils/util-linux/) and a fork util-linux-ng (http://userweb.kernel.org/~kzak/util-linux-ng/).

Util-linux-ng is smaller as it don't depends of parted libraries and so better fitted to rescue disks.

To see what is yours, you can run as root fdisk -v

Most of the time, you have to run fdisk from a rescue or minimal system, so you will have to cope with the version available there. They are mostly identical on the user point of view.

The main feature of fdisk is to don't write anything on the disk since you hit "w" and <CR> (Write, Enter). So you can experiment.

fdisk do only one thing: partitions. Don't do file system, copy....

Example

Be it a 2GB usb key seen on /dev/sdb.

As root:

fdisk /dev/sdb

The number of cylinders for this disk is set to 1088.
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)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 1973 MB, 1973420032 bytes
60 heads, 59 sectors/track, 1088 cylinders
Units = cylinders of 3540 * 512 = 1812480 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1089     1927100+   6  FAT16

This is Kernel fdisk (I know it because I installed it).

If your computer is not extremely old, you don't have to mind of the 1024 limit. So what you see is that the only partition is /dev/sdb1 and is fat 16.

¨p¨ is the option to show the present partitions. Use it frequently. You will find more examples in the example HOWTO, but you can experiment, fdisk is a good and trustable tools.

cfdisk

"This is cfdisk, a curses based disk partitioning program, which allows you to create, delete and modify partitions on your hard disk drive" according to cfdisk help. Many people likes it better than fdisk. It gives a bit more infos than fdisk and can do some more things like resizing partitions (if room is available) but hide the Extended partition (dealing automatically with it). Hiding things from the user in such delicate situation may be dangerous IMHO.

cfdisk

sfdisk

sfdisk is mostly done to be use as commanline argument for other applications or scripts. Use it only with maximum care.

lfdisk

alias of gnu fdisk to mimic Linux fdisk. You shouldn't need it.

gfdisk

Full version of gnu fdisk with advanced capability (similar to cfdsik).

gparted the Gnome Partition Editor

gparted is a basic yet very pleasant partitionner. Of course it needs a GUI, but don't requires gnome and it's dependencies are sufficently small for having it on many recovery disks. It does nearly the same as cfdisk do, but shows a graphical partition display and allows for mouse resizing.

It have some particularities. If the width of the display is too small, one have to search on right a small arrow to get the lacking commands and gparted stacks the desired work and execute it only when one clic on the "Apply all operation" green tick mark. When you know this it's use is pretty straightforward. Recommanded.

cfdisk

the Kde Partition Editor

The kde (4) partition manager is nearly identical to Gparted. It's stable release is pretty new, so I don't know it really. It's name is simply "Partitionanager", though distributions may add the kde4- prefix.

kde4 partition manager

Mandriva Diskdrake

Having not really used Mandriva for some years now, I can't judge Diskdrake. At first sight it ressemble much gparted.

http://wiki.mandriva.com/en/Diskdrake

Any Mndriva user is encouraged to give more info in the tldp wiki.

Red Hat and Fedora Core Disk Druid

The Red hat disk druid looks like a cfdisk clone:

http://www.redhat.com/docs/manuals/linux/RHL-7-Manual/install-guide/s1-textmode-partition.html

http://docs.fedoraproject.org/fedora-install-guide-en/fc5/ch-disk-partitioning.html

openSUSE YaST

openSUSE make a great work on the partitionner. The YaST2 partitionner module is able to cope with LVM and RAID and so is more a disk manager than a simple partitionner.

Yast2

This makes it quite intimidating. However it's a great tool and a lot of openSUSE users now routinely work with RAID and LVM. This is far from the scope of this HOWTO though.

Debian Partman

Based on parted.

Partition-Mass-Storage-Tools-HOWTO (last edited 2010-01-12 08:36:17 by jdd)