Sunteți pe pagina 1din 6

Partitioning

• Pre-Installation tool
– Disk Druid
• Post-Installation tools
– fdisk
– parted
– cfdisk
– sfdisk

Naming Conventions Commands

To
Toview
viewlist
listof
ofpartitions
partitions
[root@comp1
[root@comp1 ~]#fdisk -l <devicename>
~]#fdisk -l <device name>
Controller Master / Slave Linux Solaris

Primary Master /dev/hda c0d0


IDE-0
Primary Slave /dev/hdb c0d1

Secondary Master /dev/hdc c1d0


IDE-1
Secondary Slave /dev/hdd c1d1
Creation of Partition Creation of Partition
Creating
Creatingaanew newpartition
partition
[root@comp1
[root@comp1~]# ~]#fdisk /dev/hda
The number of cylinders for this disk is set to 4865.
The number of cylinders for this disk is set to 4865.
Creating There
Thereisisnothing
nothingwrong
wrongwith
withthat,
that,but
butthis
thisisislarger
largerthan
than1024,
Creatingaanew
newpartition
partition and
1024,
andcould
couldin
incertain
certainsetups
setupscause
causeproblems
problemswith:with:
[root@comp1 ~]#fdisk <device name>
[root@comp1 ~]#fdisk <device name> 1) software that runs at boot time (e.g., old versions of
1) software that runs at boot time (e.g., old versions of LILO)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
toggle abootable
a bootableflag
flag
bb edit
editbsd
bsddisklabel
disklabel
cc toggle
toggle the dos compatibilityflag
the dos compatibility flag
dd delete
deleteaapartition
partition
ll list known partition types
list known partition types
mm print
printthis
thismenu
menu
nn add
addaanewnewpartition
partition
oo create
create a newempty
a new emptyDOS DOSpartition
partitiontable
table
pp print
print the partitiontable
the partition table
qq quit without saving changes
quit without saving changes
ss create
createaanewnewempty
emptySun Sundisklabel
disklabel
tt change
changeaapartition's
partition'ssystem
systemidid
uu change display/entry
change display/entry unitsunits
vv verify the partition table
verify the partition table
ww write
writetable
tableto
todisk
diskand
andexit
exit
xx extra
extrafunctionality
functionality(experts
(expertsonly)
only)
Command
Command(m
(mfor
forhelp):
help):

Commands Ext2 vs Ext3

Updates
Updatesthe
thepartition
partitiontable
tableto
tokernel
kernelwithout
withoutrestarting
restarting
[root@comp1
[root@comp1~]#partprobe
~]#partprobe Ext2 Ext3

• No journaling support • Journaling supported

• Less speed • More speed

• Less secure • More secure


Formatting of partition Mounting Filesystem

To
Toformat
formatpartition
partitionusing
usingext3
ext3filesystem
filesystem Created
Createdaadirectory
directoryfor
formounting
mountingthe
thepartition
partition
[root@comp1 ~]#mkfs.ext3 <partition>
[root@comp1 ~]#mkfs.ext3 <partition> [root@comp1 ~]#mkdir <directory name>
[root@comp1 ~]#mkdir <directory name>

To
Toformat
formatpartition
partitionusing
usingext2
ext2filesystem
filesystem To
Tomount
mountthe
thefilesystem
filesystemononthe
thecreated
createddirectory
directory
[root@comp1 ~]#mkfs.ext2 <partition>
[root@comp1 ~]#mkfs.ext2 <partition> [root@comp1
[root@comp1 ~]#mount <partition> <directoryname>
~]#mount <partition> <directory name>

To
Toformat
formatpartition
partitionusing
usingvfat
vfatfilesystem
filesystem To
Tounmount
unmountthe
thefilesystem
filesystem
[root@comp1 ~]#mkfs.vfat <partition> [root@comp1
[root@comp1~]#umount
~]#umount <directory
<directoryname>
name>
[root@comp1 ~]#mkfs.vfat <partition>

Mounting Filesystem - Permanently /etc/fstab

To
Toadd
addthe
theentry
entry
To
Tomount
mountfilesystem
filesystempermanently
permanently ##This
Thisfile
fileis
isedited
editedby
byfstab-sync
fstab-sync--see
see'man
'manfstab-sync'
fstab-sync'for
fordetails
details
[root@comp1 ~]#vi /etc/fstab
[root@comp1 ~]#vi /etc/fstab LABEL=/1
LABEL=/1 // ext3
ext3 defaults
defaults 0000
/dev/hda1
/dev/hda1 /boot
/boot ext3
ext3 defaults
defaults 1122

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
/dev/hda2 /usr
/usr ext3
ext3 defaults
defaults 0000
LABEL=/var1
LABEL=/var1 /var
/var ext3
ext3 defaults
defaults 1122
LABEL=SWAP-hda7
LABEL=SWAP-hda7 swap
swap swap
swap defaults
defaults 0000
/dev/hdd
/dev/hdd /media/cdrom
/media/cdrom auto
auto pamconsole,exec,noauto,managed
pamconsole,exec,noauto,managed0000
/dev/hda10
/dev/hda10 /mnt
/mnt ext3
ext3 defaults
defaults 0000
Converting from Ext2 to Ext3 Converting from Ext3 to Ext2

Unmount
Unmountthe
thepartition
partition Unmount
Unmountthe
thepartition
partition
[root@comp1 ~]#umount <partition>
[root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>
[root@comp1 ~]#umount <partition>

Converting
Convertingfrom
fromExt2
Ext2to
toExt3
Ext3filesystem
filesystem Converting
Convertingfrom
fromExt3
Ext3to
toExt2
Ext2filesystem
filesystem
[root@comp1 ~]#tune2fs –j <partition>
[root@comp1 ~]#tune2fs –j <partition> [root@comp1
[root@comp1 ~]#tune2fs –O ^has_ journal <partition>
~]#tune2fs –O ^has_ journal <partition>

Mount
Mountthe
thepartition
partitionto
touse
useitit Mount
Mountthe
thepartition
partitionto
touse
useitit
[root@comp1
[root@comp1 ~]#mount <partition> <directoryname>
~]#mount <partition> <directory name> [root@comp1
[root@comp1 ~]#mount <partition> <directoryname>
~]#mount <partition> <directory name>
[root@comp1
[root@comp1~]#mount
~]#mount [root@comp1
[root@comp1~]#mount
~]#mount

Label How swap works ?

To
Toassign
assignlabel
label
New
New
[root@comp1
[root@comp1 ~]#e2label <partition> <label_name>
~]#e2label <partition> <label_name> Process D
Process
Process

RAM HDD
Swap
To Process C
Toview
viewexisting
existinglabel
label Partition
[root@comp1 ~]#e2label <partition>
[root@comp1 ~]#e2label <partition> Process B hda3

Idle
Idle Process A hda2

Operating hda1
System
To
Tosee
seemounted
mountedpartition
partitionwith
withLabel
Label
[root@comp1
[root@comp1~]#mount
~]#mount -l-l RAM
RAM
FULL
FULL
Creation of Swap partition Swap Partition

Creating
Creatingaanew
newpartition
partition To
Toenable
enableswap
swapon
onthe
theswap
swappartition
partition
[root@comp1 ~]#fdisk <options> <partition>
[root@comp1 ~]#fdisk <options> <partition> [root@comp1 ~]#swapon <partition>
[root@comp1 ~]#swapon <partition>

To
Tomake
makeaapartition
partitionswap
swappartition
partition To
Tocheck
checkthe
thestatus
statusofofswap
swapused
used
[root@comp1 ~]#mkswap <partition>
[root@comp1 ~]#mkswap <partition> [root@comp1 ~]#swapon -s <partition>
[root@comp1 ~]#swapon -s <partition>

To
Todisable
disablethe
theswap
swappartition
partition
[root@comp1 ~]#swapoff <partition>
[root@comp1 ~]#swapoff <partition>

Mounting Removable Devices Mounting Removable Devices

To
Tomount
mountFloppy
FloppyDrive
Drive To
Tomount
mountTape
TapeDrive
Drive(SCSI)
(SCSI)
[root@comp1 ~]#mount /dev/fd0 /mnt
[root@comp1 ~]#mount /dev/fd0 /mnt [root@comp1
[root@comp1 ~]#mount /dev/st0 /mnt
~]#mount /dev/st0 /mnt

To To
Tomount
mountTape
TapeDrive
Drive(IDE)
Tomount
mountCdrom
Cdrom (IDE)
[root@comp1 [root@comp1
[root@comp1 ~]#mount /dev/ht0 /mnt
~]#mount /dev/ht0
[root@comp1 ~]#mount /dev/cdrom /mnt
~]#mount /dev/cdrom /mnt /mnt

To
Tomount
mountPen
PenDrive
Drive
[root@comp1
[root@comp1 ~]#mount /dev/sda1 /mnt
~]#mount /dev/sda1 /mnt
Disk Management

To
Toview
viewtotal
totalfree
freespace
spaceof
ofaadisk
disk
[root@comp1 ~]#hwbrowser
[root@comp1 ~]#hwbrowser & &

To
Toview
viewfree
freespace
spaceof
ofpartition
partition
[root@comp1
[root@comp1~]#df
~]#df -h
-h

To
Toview
viewused
usedspace
spaceof
ofaapartition
partition
[root@comp1
[root@comp1~]#du
~]#du -sh
-sh

To
Toknow blocksizeof
knowblocksize of aa partition
partition
[root@comp1 ~]#blockdev --
[root@comp1~]#blockdev --getbsz
getbsz <partition>
<partition>

S-ar putea să vă placă și