Partition
9:11 AM
By
Rajashekar Reddy BusiReddy
RHCE
0
comments
Partition
Partitioning is a means to divide a
single hard drive into many logical drives. A partition is contiguous set of
blocks on a drive that are treated as an independent disk.
Purpose
of partition
Ease of use -
Make it easier to recover a corrupted file system or operating system
installation.
Performance -
Smaller file systems are more efficient. You can tune file system as per
application such as log or cache files. Dedicated swap partition can also
improve the performance (this may not be true with latest Linux kernel 2.6).
Security -
Separation of the operating system files from user files may result into a
better and secure system. Restrict the growth of certain file systems is
possible using various techniques.
Backup and Recovery - Easier backup and recovery.
Stability and efficiency - You can increase disk space efficiency by formatting
disk with various block sizes. It depends upon usage. For example, if the data
is lots of small files, it is better to use small block size.
Testing - Boot multiple operating systems such as Linux, Windows and
FreeBSD from a single hard disk.
Types of
partition
There are three
types of partions are there .they are
Primary
A primary partition may contain an
operating system along with any number of data files (for example, program
files, user files, and so forth). Before an OS is installed, the primary
partition must be logically formatted with a file system compatible to the OS.
If you have
multiple primary partitions on your hard disk, only one primary partition may
be visible and active at a time. The active partition is the partition from
which an OS is booted at computer startup. Primary partitions other than the
active partition are hidden, preventing their data from being accessed. Thus,
the data in a primary partition can be accessed (for all practical purposes)
only by the OS installed on that partition.
If you plan to install more than one operating system on your hard disk, you probably need to create multiple primary partitions; most operating systems can be booted only from a primary partition.
If you plan to install more than one operating system on your hard disk, you probably need to create multiple primary partitions; most operating systems can be booted only from a primary partition.
Extended
An extended partition does not directly hold data. You must create logical partitions within the extended partition in order to store data. Once created, logical partitions must be logically formatted, but each can use a different file system.
Logical Partition
Logical partitions
is partition that are created inside the extended partition
Partition Creation
fdisk command is
used to create a partition
d:deleate a partition
n:add a new partition
p:print partition table
q:quit without saving changes
w:write table to disk and exit
t:to select the type of partition
partprobe command is used to update the partition table
mkfs.<filesystem name>:used to format filesystem
mount <partition> <directory name> to mount
the directory
umount <directory name> to unmount the directory
umount <directory name> to unmount the directory
Note: we have to use /etc/fstab to mount partition
permanently
Example:
[root@raju]#vi /etc/fstab
/dev/sda4 /raju
ext4 defaults 0 0
[root@raju]#fdisk
/dev/sda
command(mfor help):n
First cylinder (36495-38913,
default 36495):
|
Using default value 36495
|
Last cylinder, +cylinders or
+size{K,M,G} (36495-38913, default 38913): +100M
|
Command (m for help): w
[root@raju]#partx -a /dev/sda
|
[root@raju]#mkfs.ext4 /dev/sda5
[root@raju]#mkdir /raju
[root@raju]#vi /etc/fstab
/dev/sda4 /raju
ext4 defaults 0 0
Leave Your Comment Below If You Like This Post
0 comments: