Partitioning
• Pre-Installation tool – Disk Druid • Post-Installation tools – Fdisk – Parted – Cfdisk – sfdisk Naming Conventions
Controller Master / Slave Linux Solaris
Primary Master hda c0d0 IDE-0 Primary Slave hdb c0d1
Secondary Master hdc c1d0 IDE-1 Secondary Slave hdd c1d1 Commands
To view list of partitions [root@comp1 ~]#fdisk -l
Creating a new partition [root@comp1 ~]#fdisk
Creating a new partition [root@comp1 ~]#fdisk /dev/hda The number of cylinders for this disk is set to 4865. 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): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
Command (m for help): Commands
Updates the partition table to kernel without restarting [root@comp1 ~]#partprobe Ext2 vs Ext3
Ext2 Ext3
• No journaling support • Journaling supported
• Less speed • More speed
• Less secure • More secure Formatting of partition
To format partition using ext3 filesystem [root@comp1 ~]#mkfs.ext3
To format partition using ext2 filesystem [root@comp1 ~]#mkfs.ext2
To format partition using vfat filesystem [root@comp1 ~]#mkfs.vfat
Created a directory for mounting the partition [root@comp1 ~]#mkdir
To mount the filesystem on the created directory [root@comp1 ~]#mount
To unmount the filesystem [root@comp1 ~]#umount
To mount filesystem permanently [root@comp1 ~]#vi /etc/fstab /etc/fstab
To add the entry # This file is edited by fstab-sync - see 'man fstab-sync' for details LABEL=/1 / ext3 defaults 0 0 /dev/hda1 /boot ext3 defaults 1 2 None /dev/pts devpts gid=5,mode=620 0 0 None /dev/shm tmpfs defaults 0 0 LABEL=/home1 /home ext3 defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 /dev/hda2 /usr ext3 defaults 0 0 LABEL=/var1 /var ext3 defaults 1 2 LABEL=SWAP-hda7 swap swap defaults 0 0 /dev/hdd /media/cdrom auto pamconsole,exec,noauto,managed 0 0 /dev/hda10 /mnt ext3 defaults 0 0 Converting from Ext2 to Ext3
Unmount the partition [root@comp1 ~]#umount
Converting from Ext2 to Ext3 filesystem [root@comp1 ~]#tune2fs –j
Mount the partition to use it [root@comp1 ~]#mount
Unmount the partition [root@comp1 ~]#umount
Converting from Ext3 to Ext2 filesystem [root@comp1 ~]#tune2fs –O ^has_ journal
Mount the partition to use it [root@comp1 ~]#mount
To assign label [root@comp1 ~]#e2label
To view existing label [root@comp1 ~]#e2label
To see mounted partition with Label [root@comp1 ~]#mount -l How swap works ?
New Process D Process
RAM HDD Swap Process C Partition
Process B hda3
Idle Process A hda2
Operating hda1 System
RAM FULL Creation of Swap partition
Creating a new partition [root@comp1 ~]#fdisk
To make a partition swap partition [root@comp1 ~]#mkswap
To enable swap on the swap partition [root@comp1 ~]#swapon
To check the status of swap used [root@comp1 ~]#swapon -s
To disable the swap partition [root@comp1 ~]#swapoff