| Summary Creating Partitions File Systems Mounting File System Files /etc/fstab |
Creating a new partition on Empty space
(do not apply on freeBSD)
fdisk is started by typing (as root)
fdisk device
at the command prompt. device might be something like /dev/hda or /dev/sda.
The basic fdisk commands you need are:
- p
print the partition table
- n
create a new partition
- d
delete a partition
- q
quit without saving changes
- w
write the new partition table and exit
I start fdisk from the shell prompt:
# fdisk /dev/hdb |
Command (m for help): p Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders Units = cylinders of 4032 * 512 bytes |
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-621, default 1):<RETURN> Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-621, default 621): +384M |
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (197-621, default 197):<RETURN> Using default value 197 Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M |
Device Boot Start End Blocks Id System /dev/hdb1 1 196 395104 83 Linux /dev/hdb2 197 262 133056 83 Linux |
Command (m for help): a Partition number (1-4): 1 |
Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap) Command (m for help): p |
Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System /dev/hdb1 * 1 196 395104+ 83 Linux /dev/hdb2 197 262 133056 82 Linux swap /dev/hdb3 263 458 395136 83 Linux /dev/hdb4 459 621 328608 83 Linux |
Creating file systems (Formating)
(Dont apply on freeBSD)
mkfs command is used to create filesystems on partitions.
mkfs -t type
Example : mkfs -t ext3 /dev/hda3
Description : This will create ext3 filesystem on /dev/hda3 partition.