A typical UNIX installation will divide one or more hard drives into multiple partitions.
In Linux, each disk is given its own device name: /dev/hdX (X can range from a-z) – IDE disks /dev/sdX (X can range from a-z) – SCSI disks
A partition number is added to the device name: /dev/hdXY (Y is the partition number) – IDE disks /dev/sdXY (Y is the partition number) – SCSI disks For example, the first partition on the first IDE drive on a system would be /dev/hda1 .
Disk partition information can be viewed using the ‘df’ command.
In UNIX, a physical disk partition is associated with a directory path, sometimes referred to as a mount point .
All files that are in directories associated with a mount point are stored on the mount point’s physical partition.
If a directory path is not explicitly associated with a physical disk partition, its files are stored under the root ( “/” ) partition.
UNIX Partition Example /usr 2GB / (root) 1.5GB /home 4GB swap Example Partitioning Scheme: Total Hard Drive Space: 8GB Contains all files under the /usr directory (I.e. /usr/local/bin/pico, /usr/bin/vi, etc.) Contains all files under the /home directors (I.e. /home/chrisjur, /home/iti1234) Contains all other files and directors, such as /var, /opt, /sbin, etc. [HARD DRIVE]
Making disk partitions is easy; Changing them can be hard.
It’s not often easy to expand or shrink disk partitions (in fact, it’s impossible to do on many operating systems), so make sure you have adequate space for your data storage.
You can always create partitions from new hard drive.
You can always create partitions from un-partitioned space on existing, in-use hard drives.
Example: Adding a Partition Using Un-partitioned Space /dev/hda1 Mounted on /home (Unused) /dev/hda1 Mounted on /home /dev/hda2 Mounted on /home2 You can easily take unused hard disk space, format it, partition it and mount is as a new file system.
Launch fdisk – edit hard disk /dev/hda: > /sbin/fdisk /dev/had
Type “p” to print the current partition table.
You can now create a new partition, specify the size of the partition and then specify its file system type.
The “n” option will allow you to add a new partition. You are prompted to specify whether you want to use a primary partitions 1 to 4) or logical partition (partitions 5 and above). You should choose “p” for primary partition.
You will be asked to specify a partition number. Refer back to the partition table -You can choose a partition number that is not used from 1-4.
Now that you have a fresh chunk of useable disk space, you need to decide how you will access it.
You must choose a unique and empty directory path to be associated with your partition – this is referred to its mount point.
For example, if you’ve created a partition /dev/hdb2, and you want to access its disk space via the path /newdisk, you must first create the path /newdisk (“mkdir /newdisk”) and we must then mount the partition on that path.