Tuesday, August 24, 2010

Disk Managment (Partitioning)



1) Partition is a part of hard disk which is to be utilized for a different

cause than it's neighbouring partition.



2) Partition is "Hardware" since it comes from a hard disk which is a

hardware . Basically anything can be holded in hands is a hardware

, and as hard disk could be , hard disk and hence partition is a h/w.



3) Partitions could be further subdidvided into two types -:



i) Primary Partitions -> It is an actual partition which can be given a

label and can be used for some purpose. There can be max 4 primary

partitions on a hard disk ( limitations of BIOS which was first

inroduced by IBM and all other personal computers are it's clones.



ii) Extended Partition -> This is ideally not a partition but a concept

that can be further divided into logical partitions which can be

further given labels and used for some purpose.



4) Only 1 extended partition can be created from a hard disk which can be

further sub divided to 64 logical volumes ( partitions ) . Windows

allows only 21 logical partitions.



Max. Number of logical volumes also depends on motherboard . In some

cases only 16 logical volumes are allowed from an extended partition.



5) Windows can oly be installed on an primary , active partition.



6) Drive in Windows = Filesystem in Linux



7) Normally the important directories which if filled could hamper the

functioning of system are made a totally different filesystem on a

different partition in linux.



Normally , the various directories which are given different partitions

are /boot , / , /home , /tmp , /var , /usr .



For eg. -> /home is the directory in which all users have their home

directories , if there is no quota policy for users in place , in

case they dump more and more data in their home directories and if

/home is not in another partition , all data will be going into the

"/" directory and ultimately it gets filled up . This will make the

system slow and ultimately system may hang and will give problems

later while booting.Even the root user will not be able to login

because his home directory ( /root ) is in / directory which is

already full.



To slove above problem , root user can login from linux rescue mode

and try to do the cleanup.



8) 'df' is command used to see all filesystems present on the system and

being used by linux kernel and their current usage.



df -h gives the output in human readable form ( in MB's )



For eg. -> df -h

Filesystem Size Used Avail Use% Mounted on

/dev/hda7 950M 116M 786M 13% /

/dev/hda6 99M 9.2M 85M 10% /boot

none 109M 0 109M 0% /dev/shm

/dev/hda10 950M 17M 885M 2% /tmp

/dev/hda12 8.3G 4.5G 3.5G 57% /usr

/dev/hda11 950M 263M 639M 30% /var

/dev/vg/lv 465M 8.1M 433M 2% /home



9) Minimum 3 partitions required for a successful installation
/boot , / , swap



10) 7 Partitions required for a successful and efficient linux installation
/boot , / , /home , swap , /tmp , /var , /usr



11) For getting an optimum performance from a system , no partition should

be filled more than 82% of it's size.



12) Partition can be done in order to use the free space, to install

multiple OS, to format HDD with multiple file systems etc



13) LOGICAL FILE SYSTEM:

for windows - FAT16, FAT32 and NTFS

Linux - ext2 and ext3

################################################################

How to Partitioning,Formating & Mounting. 
How to create swap partition?




1. To view partition table

# fdisk -l



2.To create new partition

# fdisk

Suppose we have created /dev/hda9 partition.



3.To update partition table to kernel without rebooting

# partprobe



4.To format partition table with file system ext2 and ext3



# mkfs.ext2

# mkfs.ext3

eg.

# mkfs.ext3 /dev/hda9



5.To mount partition table on mount point(on created directory)

# mount

eg.

# mount /dev/hda9 /linux



MOUNTING : Means creating a link between physical and logical file system

in order to access partitions through mount point.



6.To umount partition

# umount

eg.

# umount /linux



7.To mouint file system permentatly # vi /etc/fstab



/dev/hda9 /linux ext3 defaults 0 0

8.Convertiting file system from ext2 -> ext3

# tune2fs -j

eg.

# tune2fs -j /dev/hda9



9.Converting file system from ext3 -> ext2
# tune2fs -O^has_journal

eg.

# tune2fs -O^has_journal /dev/hda9



10.To assign a lable

# e2lable

eg.

# e2lable /dev/hda9 /songs



11.To view existion lable

# e2lable

eg.

# e2lable /dev/hda9

/songs



================= SWAP PARTITION ===============

We create a swap partition for a support to ram. In case If ram is a full that time
the swap partition is active.

12.TO make partition a swap partition

# mkswap



13. To enable swap partition

# swapon /dev/hda9



14.To view status of swap partition

# swapon -s



15.To disable partition

# swapoff

#################################################