1
1
Partitioning
Pre-Installation tool Disk Druid Post-Installation tools Fdisk Parted Cfdisk sfdisk
2
2
Naming Conventions
Controller
Master / Slave
Linux
Solaris
Primary Master
hda
c0d0
Primary Slave
hdb
c0d1
Secondary Master
hdc
c1d0
Secondary Slave
hdd
c1d1
IDE-0
IDE-1
3
3
Commands
To Toview viewlist listof ofpartitions partitions [root@comp1 ~]#fdisk -l <device [root@comp1 ~]#fdisk -l <devicename> name>
4
4
Creation of Partition
Creating Creatingaanew newpartition partition [root@comp1 ~]#fdisk <device [root@comp1 ~]#fdisk <devicename> name>
5
5
Creation of Partition Creating Creatingaanew newpartition partition [root@comp1 [root@comp1~]# ~]#fdisk /dev/hda The Thenumber numberof ofcylinders cylindersfor forthis thisdisk diskisisset setto to4865. 4865. There Thereisisnothing nothingwrong wrongwith withthat, that,but butthis thisisislarger largerthan than1024, 1024, and andcould couldin incertain certainsetups setupscause causeproblems problemswith: with: 1) software that runs at boot time (e.g., old versions of LILO) 1) software that runs at boot time (e.g., old versions of LILO) 2) 2)booting bootingand andpartitioning partitioningsoftware softwarefrom fromother otherOSs OSs (e.g., (e.g.,DOS DOSFDISK, FDISK,OS/2 OS/2FDISK) FDISK) Command Command(m (mfor forhelp): help):m Command Commandaction action aa toggle toggleaabootable bootableflag flag bb edit editbsd bsddisklabel disklabel cc toggle togglethe thedos doscompatibility compatibilityflag flag dd delete deleteaapartition partition ll list known partition types list known partition types m print m printthis thismenu menu nn add addaanew newpartition partition oo create a new create a newempty emptyDOS DOSpartition partitiontable table pp print printthe thepartition partitiontable table qq quit quitwithout withoutsaving savingchanges changes ss create createaanew newempty emptySun Sundisklabel disklabel tt change changeaapartition's partition'ssystem systemid id uu change display/entry units change display/entry units vv verify verifythe thepartition partitiontable table w write w writetable tableto todisk diskand andexit exit xx extra extrafunctionality functionality(experts (expertsonly) only) Command Command(m (mfor forhelp): help):
6
6
Commands
Updates Updatesthe thepartition partitiontable tableto tokernel kernelwithout withoutrestarting restarting [root@comp1 ~]#partprobe [root@comp1 ~]#partprobe
7
7
Ext2 vs Ext3
Ext2
Ext3
No journaling support
Journaling supported
Less speed
More speed
Less secure
More secure
8
8
Formatting of partition
To Toformat format partition partitionusing usingext3 ext3filesystem filesystem [root@comp1 ~]#mkfs.ext3 <partition> [root@comp1 ~]#mkfs.ext3 <partition>
To Toformat format partition partitionusing usingext2 ext2filesystem filesystem [root@comp1 [root@comp1~]#mkfs.ext2 ~]#mkfs.ext2 <partition> <partition>
To Toformat formatpartition partitionusing usingvfat vfatfilesystem filesystem [root@comp1 ~]#mkfs.vfat <partition> [root@comp1 ~]#mkfs.vfat <partition>
9
9
Mounting Filesystem
Created Createdaadirectory directoryfor formounting mountingthe thepartition partition [root@comp1 ~]#mkdir [root@comp1 ~]#mkdir
To Tomount mountthe thefilesystem filesystem on onthe the created createddirectory directory [root@comp1 [root@comp1~]#mount ~]#mount <partition> <partition> name>
To Tounmount unmountthe thefilesystem filesystem [root@comp1 [root@comp1~]#umount ~]#umount name>
10
10
Mounting Filesystem - Permanently
To Tomount mountfilesystem filesystempermanently permanently [root@comp1 [root@comp1~]#vi ~]#vi /etc/fstab /etc/fstab
11
11
/etc/fstab
To Toadd addthe theentry entry ##This Thisfile fileisisedited editedby byfstab-sync fstab-sync--see see'man 'manfstab-sync' fstab-sync'for fordetails details LABEL=/1 // ext3 defaults 0000 LABEL=/1 ext3 defaults /dev/hda1 /dev/hda1
/boot /boot
ext3 ext3
None None
/dev/pts /dev/pts
devpts devpts gid=5,mode=620 gid=5,mode=620 0000
None None
/dev/shm /dev/shm
tmpfs tmpfs
defaults defaults
0000
LABEL=/home1 LABEL=/home1
/home /home
ext3 ext3
defaults defaults
0000
none none
/proc /proc
proc proc
defaults defaults
0000
none none
/sys /sys
sysfs sysfs
defaults defaults
0000
/dev/hda2 /usr ext3 /dev/hda2 /usr ext3 LABEL=/var1 /var ext3 LABEL=/var1 /var ext3 LABEL=SWAP-hda7 swap LABEL=SWAP-hda7 swap swap swap /dev/hdd /media/cdrom /dev/hdd /media/cdrom auto auto /dev/hda10 /mnt ext3 /dev/hda10 /mnt ext3
defaults defaults
1122
defaults 0000 defaults defaults 1122 defaults defaults 0000 defaults pamconsole,exec,noauto,managed pamconsole,exec,noauto,managed0000 defaults 0000 defaults
12
12
Converting from Ext2 to Ext3
Unmount Unmountthe thepartition partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>
Converting Convertingfrom fromExt2 Ext2to toExt3 Ext3filesystem filesystem [root@comp1 [root@comp1~]#tune2fs ~]#tune2fs jj <partition> <partition>
Mount Mountthe thepartition partitionto touse useitit [root@comp1 ~]#mount <partition> name> [root@comp1 [root@comp1~]#mount ~]#mount 13
13
Converting from Ext3 to Ext2
Unmount Unmountthe thepartition partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>
Converting Convertingfrom fromExt3 Ext3to toExt2 Ext2filesystem filesystem [root@comp1 [root@comp1~]#tune2fs ~]#tune2fs O O^has_ ^has_journal journal <partition> <partition>
Mount Mountthe thepartition partitionto touse useitit [root@comp1 ~]#mount <partition> name> [root@comp1 [root@comp1~]#mount ~]#mount 14
14
Label
To Toassign assignlabel label [root@comp1 ~]#e2label <partition> [root@comp1 ~]#e2label <partition>
To Toview viewexisting existinglabel label [root@comp1 [root@comp1~]#e2label ~]#e2label <partition> <partition>
To Tosee seemounted mountedpartition partitionwith withLabel Label [root@comp1 ~]#mount -l [root@comp1 ~]#mount -l
15
15
How swap works ?
New New Process Process
Process D
Process C
HDD Swap Partition
Process B
hda3
Process A
hda2
Operating System
hda1
RAM
Idle Idle
RAM RAM FULL FULL 16
16
Creation of Swap partition
Creating Creatingaanew newpartition partition [root@comp1 ~]#fdisk [root@comp1 ~]#fdisk <partition> <partition>
To Tomake makeaapartition partitionswap swappartition partition [root@comp1 [root@comp1~]#mkswap ~]#mkswap<partition> <partition>
17
17
Swap Partition
To Toenable enableswap swapon onthe theswap swappartition partition [root@comp1 ~]#swapon <partition> [root@comp1 ~]#swapon <partition>
To Tocheck checkthe thestatus statusof ofswap swapused used [root@comp1 [root@comp1~]#swapon ~]#swapon -s -s<partition> <partition>
To Todisable disablethe theswap swappartition partition [root@comp1 [root@comp1~]#swapoff ~]#swapoff <partition> <partition>
18
18