05 Storage Administration - Partitions


Ne kete leksion



Identifikimi i disqeve ne Red Hat Enterprise Linux

Ky seksion trajton aspekte te administrimit te storage nen  Red Hat Enterprise Linux.
Ka dy menyra qe si sistemi i identifikon disqet ne RedHat:
  • ne menyre jo persistente
  • ne menyre persistente

Ne kete leksion do te pershkruajme te mekanizmin se si sistemi i identifikon disqet ne te dy menyrat.


Identifikimi ne menyre jo persistente

Menyrat qe do te pershkruajme me poshte qe perdor sistemi per te identifikuar disqet , percaktojne nje identifikues per diskun i cili mund te ndryshoje ne rastin e rikonfigurimit te disqeve si shtimi apo heqja e disqeve ekzistues.

Skedari i diskut

Si edhe ne sistemet e tjera Linux  Red Hat Enterprise Linux perdor skedaret  (device files) per te aksesuar disqet ( disk drives).  Me poshte pershkruhen rregullat qe perdor RedHat per caktimin e emrave te ktyre skedareve.


Shenim
Emrat e disqeve (Device names) ne Red Hat Enterprise Linux percaktohen ne momentin e ndezjes ( boot-time)
Per kete arsye nese ka ndryshime ne konfigurimin e disqeve mund te ndodhe qe te ndryshojme edhe emrat per disqet ekzistues pasi sistemi te rindizet ( reboot). Per kete arsye mund te kete probleme nese referencat tek disqet nuk ndryshohen sipas emrave te rinj.



Ne  Red Hat Enterprise Linux, skedaret e pajisjeve per disqet ndodhen ne dosjen   /dev/ .
Formati i emrave te skedareve varet nga lloji i hardware dhe menyra e konfigurimit.

Elementet baze qe shfaqen ne emrin e skedarit jane:
  • Tipi i pajisjes (Device type)
  • Njesia ( Unit)
  • Particioni (Partition)
 Tipi i pajisjes
 Njesia Particioni
 IDE apo SCSI
 a = i pari
b= i dyti
........
ab= i ..
 1 - particion i pare
2- particion i dyte
n- particion i n


Lloji i diskut
Dy shkronjat e pare te emrit te skedarit te diskut tregojne tipin e diskut . Nder me te zakonshmit jane:


sd -- per hardisqet SCSI
hd -- per hardisqet ATA


Indeksi
Shkronja tjeter tregon indeksin e diskut.
Per shembull :
 shkronja  "a" tregon qe eshte disku i pare,
 "b" tregon qe eshte disku i dyte etj

Prandaj emri i diskut te pare ne serverin Tuaj do te jete  hda ose  sda.
Disku i dyte qe shtoni eshte hdb ose  sdb e keshtu me rradhe

Shenim
Aftesia e teknologjise SCSI per te adresuar nje numer te madh disqesh ka kerkuar shtimin e nje karakteri shtese qe tregon indeksin e diskut. Mund te kete raste kur ne sistem ka me shume se 26 disqe. Ne kete rast 26 disqet e para ne sistem do te identifikoheshin si  sda.. sdz, ndersa  26 te tjeret do te ishin  sdaa.. sdaz, e keshtu me rradhe.


Particioni

Pjesa e trete e emrit te skedarit te diskut perfaqeson numrin e particionit. Numri i particionit mund te jete nje ose dy shifra ne varesi te numrit te particioneve qe jane krijuar ne disk

 Shembujt me poshte ilustrojne formatin e skedareve:

 Emri i Skedarit
 Kuptimi
 /dev/hda1 Particioni i pare ne diskun e pare ATA
 /dev/sdb12 Particionin e dymbedhjete ne diskun e dyte SCSI
 /dev/sdad4 Particioni i kateret ne diskun e 40 SCSI
 /dev/sda Disku i pare SCSI


Ushtrim
Identifikoni skedaret e diskut  ne serverin Tuaj

[root@localhost ~]# ls /dev/sd* -l | grep disk
brw-rw---- 1 root disk 8,  0 Mar  6 23:12 /dev/sda
brw-rw---- 1 root disk 8, 16 Mar  6 23:12 /dev/sdb
brw-rw---- 1 root disk 8, 17 Mar  6 23:12 /dev/sdb1
brw-rw---- 1 root disk 8, 18 Mar  6 23:12 /dev/sdb2
brw-rw---- 1 root disk 8, 19 Mar  6 23:12 /dev/sdb3
brw-rw---- 1 root disk 8, 20 Mar  6 23:12 /dev/sdb4
brw-rw---- 1 root disk 8, 21 Mar  6 23:12 /dev/sdb5
brw-rw---- 1 root disk 8, 32 Mar  6 23:12 /dev/sdc
brw-rw---- 1 root disk 8, 48 Mar  6 23:12 /dev/sdd
[root@localhost ~]# 

Sqarime

 Emri i Skedarit
 Kuptimi
 /dev/sdaDisku i pare SCSI.
 /dev/sdbDisku i dyte SCSI
/dev/sdb1Particioni i pare ne diskun e dyte SCSI
/dev/sdb2Particioni i dyte ne diskun e dyte SCSI
/dev/sdb3Particioni i trete ne diskun e dyte SCSI
/dev/sdcDisku i trete SCSI.
/dev/sddDisku i katert SCSI.





Linket ne /dev/disk/by-path


Pervec emrave te skedareve te diskut redhat perdor edhe nje menyre tjeter per identifikimin e disqeve.
Ne dosjen /dev/disk sistemi ruan disa linke .

Ne dosjen   /dev/disk/by-path ruan linke qe lidhin identifikuesin e diskut (harware) me emrin e skedarit ne /dev/sdx.


Per shembull disqet SCSI perdorin disa komponente per identifikimin, me konkretisht:
  • PCI identifier of the host bus adapter (HBA)
  • channel number on that HBA
  • the remote SCSI target address
  • the Logical Unit Number (LUN)

per shembull me poshte listohen disqet ne nje sistem nga /dev/disk/by-path

[root@localhost student]# ls /dev/disk/by-path/ -l
total 0
lrwxrwxrwx 1 root root  9 Mar 14 12:21 pci-0000:00:07.1-scsi-0:0:0:0 -> ../../sde
lrwxrwxrwx 1 root root  9 Mar 14 12:21 pci-0000:00:07.1-scsi-1:0:0:0 -> ../../sr0
lrwxrwxrwx 1 root root  9 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0-part4 -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root  9 Mar 14 13:15 pci-0000:00:10.0-scsi-0:0:1:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Mar 14 15:17 pci-0000:00:10.0-scsi-0:0:1:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:2:0 -> ../../sdc
lrwxrwxrwx 1 root root  9 Mar 14 12:21 pci-0000:00:10.0-scsi-0:0:3:0 -> ../../sdd
[root@localhost student]#



Identifikimi ne menyre  persistente

Menyrat qe do te pershkruajme me poshte qe perdor sistemi per te identifikuar disqet , percaktojne nje identifikues per diskun i cili nukndryshon ne rastin e rikonfigurimit te disqeve si shtimi apo heqja e disqeve ekzistues.



World Wide Identifier (WWID)  /dev/disk/by-id

World Wide Identifier (WWID) mund te perdoret per te identifikuar ne menyre persistente disqet. WWID eshte nje ID e qendrueshme , e pavarur nga sistemi konkrte qe percaktohet nga standarti SCSI.  WWID garantohet qe te jete unikeper cdo disk dhe e pavarur nga path qe perdoret per te aksesuar diskun.
Ky identifikues mund te merret duke bere nje SCSI Inquiry per te marre  Device Identification Vital Product Data (page 0x83) ose  Unit Serial Number (page 0x80).
Korrespondenca midis  WWID dhe skedarit  /dev/sdx mbahet neperjmet linkeve ne dosjen  /dev/disk/by-id/

Shembulli permbajtjes se dosjes /dev/disk/by-id

[root@localhost student]# ls /dev/disk/by-id/ -l
total 0
lrwxrwxrwx 1 root root 9 Mar 15 13:58 ata-VMware_Virtual_IDE_Hard_Drive_00000000000000000001 -> ../../sda
lrwxrwxrwx 1 root root 9 Mar 15 13:58 scsi-SATA_VMware_Virtual_00000000000000000001 -> ../../sda
[root@localhost student]#



Identifikimi nepermjet UUID /dev/disk/by-uuid


Nese nje drive ka nje file system atehere eshte e mundur qe ai te identifikohet nepermjet UUID, qe eshte akronim i Universal Unique Identifier.  UUID eshte persistent dhe bazohet ne ne metadata qe shkruhen ne disk nga disa programe, per shembull LVM shkruan te dhena pershkruese ( metadata) ne disk te cilat i perdore me pas per te marre informacione mbi diskun, perfshire UUID ose FS Label.

Korrespondenca midis UUID te njesive te diskut qe kane FileSystem ruhet ne dosjen /dev/disk/by-uuid.

Per shembull

nga disqet qe duken ne /dev/disk/by-path

[root@localhost student]# ls /dev/disk/by-path/ -l
total 0
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:07.1-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:07.1-scsi-1:0:0:0 -> ../../sr0
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0-part4 -> ../../sdb4
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:0:0-part5 -> ../../sdb5
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:1:0 -> ../../sdc
lrwxrwxrwx 1 root root 10 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:1:0-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:2:0 -> ../../sdd
lrwxrwxrwx 1 root root  9 Mar 15 13:58 pci-0000:00:10.0-scsi-0:0:3:0 -> ../../sde
[root@localhost student]#

vetem particionet e /dev/sdb kane korrespondence ne /dev/disk/by-uuid pasi ato jane te vetmet qe kane file sistem:

[root@localhost student]# ls /dev/disk/by-uuid/ -l
total 0
lrwxrwxrwx 1 root root 10 Mar 15 13:58 220e3c6e-c730-402f-9b6d-d7d13446d4e7 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar 15 13:58 3ffc3610-2d6b-424a-a723-42b1678b20c6 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Mar 15 13:58 9caf33ea-32ce-4674-9ab1-e9b148dbacb8 -> ../../sdb3
lrwxrwxrwx 1 root root 10 Mar 15 13:58 bc67a097-6666-43c7-a082-5c3d9d7cc2ba -> ../../sdb5
[root@localhost student]#

/dev/sdb4 nuk shfaqet pasi eshte particioni SWAP.

Nese e formatojme edhe particionin /dev/sdc1 psh me ext4

[root@localhost student]# mkfs.ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
...................................................


do te veme re qe ai  do te shfaqet ne /dev/disk/by-uuid

[root@localhost student]# ls /dev/disk/by-uuid/ -l
total 0
lrwxrwxrwx 1 root root 10 Mar 15 13:58 220e3c6e-c730-402f-9b6d-d7d13446d4e7 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar 15 13:58 3ffc3610-2d6b-424a-a723-42b1678b20c6 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Mar 15 13:58 9caf33ea-32ce-4674-9ab1-e9b148dbacb8 -> ../../sdb3
lrwxrwxrwx 1 root root 10 Mar 15 14:22 a7c6d384-57bb-4efe-8782-0d6d6523accf -> ../../sdc1
lrwxrwxrwx 1 root root 10 Mar 15 13:58 bc67a097-6666-43c7-a082-5c3d9d7cc2ba -> ../../sdb5
[root@localhost student]#



Etiketat e sistemit te skedareve ( File System Labels)

Disa sisteme skedaresh kane aftesine te ruajne nje etikete -- nje string qe mund te perdoret per te identifikuar te dhenat qe permban sistemi i skedareve.
Etiketa mund te perdoret me pas kur ngarkojme sistemin e skedareve duke shmangur nevojen e perdorimit te emrit te skedarit te diskut.

Etiketat e sistemit te skedareve jane nje zgjidhje e mire per te referuar disqet; megjithate:
  • etiketat e sistemit te skedareve duhet te jene unike ne te gjithe sistemin.Nese ka me shume se nje sisteme skedaresh me te njejten etikete , mund te shkaktohen probleme ne referimin e diskut.
  • Ka raste kur nuk perdoren sistemet e skedareve  (per shembull disa database), ne keto raste nuk mund te perdoren etiketat e sistemite te skedareve per te referuar disqet.



Programi devlabel

Alternatives to device files

Duke qene se heqja ose shtimi i disqeve mund te shkaktoje ndryshimin e emrave te skedareve per diskqe ose particionet ekzistuese, ekziston rreziku qe programet e mos funksionojne korrekt pasi mund te mos gjejne me disqet pas rindezjes se sistemi.
Me poshte po e ilustrojme kete rresik  me nje liste veprimesh qe mund te rezultojne ne nje situate problematike:


Ndonese problemi duket kritik ne praktike rralle e hasim kete problem per disa arsye:

  1. Se pari , te tilla rikonfigurime te hardware nuk ndodhin shpesh.
  2. Se dyti, zakonisht  administratori i sistemit ka planifikuar nje kohe per te bere ndryshime e nevojshme
Megjithate, ndonese rralle problemi mund te ndodhe sidomos ne ato raste kur rikonfigurimi i disqeve eshte i shpeshte dhe nuk eshte e lejueshme qe te fikim sistemin per nje periudhe te caktuar. Aq me teper qe   "hardware hotpluggable"  e ben te lehte shtimin ose heqjen e disqeve.


Perdorimi i devlabel

Programi  devlabel ( device label) e zgjidh problemin e riemerimit te skedareve te disqeve ne nje tjeter menyre.
Programi devlabel  therritet ne ekzekutim atehere kur
  • rindizet sistemi ( reboot) 
  • kur nje disk hotplug shtohet ose hiqet
Kur ekzekutohet  devlabel lezon ne skedarin e tij te konfigurimit (/etc/sysconfig/devlabel) per te marre nje liste me disqet per te cilat eshte pergjegjes.
Per cdo pajisje ne liste,  ka nje link ( shortcut - symlink) qe shenon tek  UUID (Universal Unique IDentifier) e diskut.
Programi devlabel sigurohet qe linku shenon gjithmone tek pajisja qe u percaktua paraprakisht  --  edhe nese emri i skedarit te diskut ka ndryshuar

Nepermjet devlabel administratori mund te konfiguroje sistemin qe te perdore  /dev/projdisk iper te referuar diskun ku ndodhen projektet. Ndersa ka lidhur emrin me lart me diskun fizik per shembull  /dev/sda12.

Duke qene  UUID lexohet direkt nga pajisja,   devlabel i vetem te kerkoje ne sistem per UUID qe lidhet me /dev/projdisk

Shenim
Programi devlabel mund te mos jete instaluar si default . Mund te verifkoni ekzistencen duke listuar paketat e instaluara ose duke verifkuar ekzistencen e skedarit  /etc/sysconfig/devlabel ose te skedarit te ekzekutueshem /sbin/devlabel .
Nese nuk e gjeni paketen ne magazinat e paketave mund ta  shkarkoni ate ne linkun ne fund te kesaj faqe .


Shembull
Per ta kuptuar me mire problemin dhe zgjidhjen qe ofron devlabel sikkni ne vemendjen Tuaj rastin e meposhtem:


Sic duket ne figuren me lart , nese nje sistem ka 3 disqe SCSI dhe hiqet disku i dyte, atehere /dev/sdc behet  /dev/sdb, duke bere qe te gjithe referencat si tek  /dev/sdc edhe tek  /dev/sdb te jene te gabuara.

Seksioni Konfigurimi i devlabel pershkruan menyren e perdorimit te devlabel per te vendosur emra simbolike disqeve.

Configuring devlabel




Particionet

Ne Redhat mund te perdorim dy programe per particionimin e diskut fdisk ose parted.
Duke nisur nga version 6 Redhat rekomanden parted per disa arsye:
  • fdisk nuk e njeh  GUID Partition Table (GPT) dhe nuk eshte dizenjuar per patricione te medha
  • fdisk nuk mund te perdoret per drive me te medha se 2TB ndersa  parted po.


Programi parted i lejon perdoruesve te
  • shkojne tabelen ekzistuese te particionimit
  • te ndryshojne dimensionin e particioneve ekzistuese
  • te krijojne particione nga hapesira e lire ne disk
Si rregull paketa  parted perfshihet me instalimin e  Redhat Linux Enterprise.

[root@localhost student]# yum list parted
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.itu.edu.tr
 * extras: mirror.cherybg.com
 * updates: ftp.itu.edu.tr
Installed Packages
parted.i686          2.1-21.el6           @anaconda-CentOS-201311271240.i386/6.5
[root@localhost student]#


Per te therritut utilitetin  parted duhet te logohemi si root dhe te shkruajme parted /dev/sdx ku /dev/sdx eshte disku qe duam te konfigurojme:

[root@localhost student]# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Nese duam te fshijme ose te ridimensionojme nje particion, ai particion nuk duhet te jete ne perdorim.


Shfaqja e tabeles se particionimit



Opsioni  print shfaq tabelen e particionimit ne diskun e perzgjedhur, per shembull

[root@localhost student]# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  53.5MB  52.4MB  primary   ext4            boot
 2      53.5MB  4248MB  4194MB  primary   ext4
 3      4248MB  6362MB  2114MB  primary   linux-swap(v1)
 4      6362MB  32.2GB  25.9GB  extended
 5      6363MB  32.2GB  25.8GB  logical   ext4

(parted)   
 

Rreshtat e pare   Model: VMware, VMware Virtual S (scsi)  tregojne:
  •  Tipin e diskut
  • manufacturer,
  • model number and interface.
Ndersa pjesa tjeter tregon tabelen e particioneve

Ne tabelen e particionimit Number eshte numri i particionit, per shembull, particioni me numer (minor)  1 i korrespondon /dev/sda1.
Vlerat e  Start dhe End percaktojne ku fillon dhe ku mbaron particioni


Type percakton llojin e particionit midis :
  •  free,
  • primary,
  • extended, ose
  •  logical.

Figura me poshte ilustron dallimin midis particionit primar , extended dhe llogjik. zakonisht krijojme nje particion primary ne disk dhe me pas krijojme nje particion extended me hapesiren e mbetur. Particionin extended mund ta ndajme me tej ne particione logical.











Filesystem
eshte sistemi i skedareve qe pedor particioni qe mund te jete :
  • ext2
  • ext3
  • fat16
  • fat32
  • hfs
  • jfs
  • linux-swap
  • ntfs
  • reiserfs
  • hp-ufs
  • sun-ufs
  • xfs
Nese  Filesystem i nje particioni nu ka vlere ateher kjo do te thote qe nuk njihet  sistemi i skedareve per ate particion

Flags

Kollona Flags liston flag-et aktive ne ate particion
 Vlera te mundshme jane:
  • boot
  • root,
  • swap,
  • hidden,
  • raid,
  • lvm,
  • lba.


Shenim
Per te zgjedhur nje disk tjeter pa dale nga parted mund te perdorim opsionin select dhe emrin e diskut:

(parted) select /dev/sdbc                                                
Using /dev/sdc
(parted)


Krijimi i particioneve

Praktike

Shtojme nje disk te ri /dev/sdc me 20 gb dhe do ta particionojme.

Perpara se ta perdorim nje disk te ri duhet te percaktojme llojin e tabeles se particionimit qe do te perdore ai. ne te kundert nuk mund te lexojme particionet qe ka ai:

(parted) select /dev/sdc
Using /dev/sdc
(parted) print                                                           
Error: /dev/sdc: unrecognised disk label                                 
(parted) mklabel                                                         
New disk label type? msdos                                               
(parted)                                                                 

Shenim:
Tabela e particionimit msdos nuk lejon me shume se 4 particione ( 3 primary 1 extended, ose 4 primary). Ndersa brenda nje particioni extended mund te krijojme particione logical.


Te verifikojme hapesiren e lire qe ka disku qe sapo shtuam


(parted) print free                                                      
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type  File system  Flags
        32.3kB  21.5GB  21.5GB        Free Space

(parted) 

Do te krijojme nje particion te ri te tipit primary. Do te vini re qe do te na pyese nese particioni qe do te krijojme do te jete primari ose extended?

Nuk na lejon ne kete pike te krijojme nje particion logical pasi particionet logical krijohen si nendarje te particionit llogjik.

(parted) mkpart                                                          
Partition type?  primary/extended? primary
File system type?  [ext2]? ext4                                          
Start? 0gb                                                               
End? 5gb    
                                     

Komanda mkpart krijon nje particion te ri. Nese e therrasim pa argumenta atehere na pyet ne formen e nje "wizard" per parametrat e particionit:

Partition type? -  ne kete moment duke qene se nuk kemi particion extended e vetma mundesi eshte te krijojme nje particion primar ose extended nuk mund te krijojme particion logical                    

File system type? -  kerkon llojin e sistemit te skedareve qe duam te perdorim ne kete particion default eshte ext2

Start? -  nga cili mbyte ( mb ose gb) i diskut duam te fillojme

End? -  deri ne cilin mbyte(mb ose gb)?


te verifikojme qe particioni eshte krijuar:

(parted) print free                                                      
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  5000MB  4999MB  primary
        5000MB  21.5GB  16.5GB           Free Space

(parted)                                                                 

Te krjojme nje particion extended ( deri ne kete pike nuk mund te krijojme  particione logical)

(parted) mkpart
Partition type?  primary/extended? extended                              
Start? 5gb
End? 21gb                                                                
(parted)

Verifikojme qe particioni eshte shtuar

(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  5000MB  4999MB  primary
 2      5000MB  21.5GB  16.5GB  extended               lba

(parted)

Tani do ta ndajme particionin 2 ( extended ) ne disa particione logical.

(parted) mkpart
Partition type?  primary/logical? logical                                
File system type?  [ext2]? ext4                                          
Start? 5gb                                                               
End? 10gb                                                                
(parted) mkpart logical ext4 10gb 15gb                                      
(parted) mkpart logical ext4 15gb 20gb                                 
(parted) mkpart logical ext4 20gb 21gb  
                                

Shenim
Per particionin e pare logical ( 5gb -10gb ) kemi perdorur "wizard-in" ndersa per particionet e tjera logical qe vijojne kemi perdorur menyren e shkurtuar te komandes duke ia dhene argumentat qe ne fillim:

(parted) mkpart logical ext4 10gb 15gb   

Te verifikojme qe particioni extended eshte ndare ne particione logjike:

(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  5000MB  4999MB  primary
 2      5000MB  21.5GB  16.5GB  extended               lba
 5      5001MB  10.0GB  5000MB  logical
 6      10.0GB  15.0GB  4999MB  logical
 7      15.0GB  20.0GB  4999MB  logical
 8      20.0GB  21.5GB  1474MB  logical

(parted)         

Formatimi dhe emertimi i nje particioni

Per te formatuar partitionin perdorim komanden mkfs.ext4 nese duam ta formatojme ne ext4.


Shenim:
Nuk mund te formatojme particionin extended por mund te formatojme particionet llogjike qe ndodhen brenda tij



[root@localhost student]# mkfs.ext4 /dev/sdc5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
305216 inodes, 1220608 blocks
61030 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1249902592
38 block groups
32768 blocks per group, 32768 fragments per group
8032 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost student]#

Ta shtojme tek  /etc/fstab

Ta shtojme particionin ne /etc/fstab ne menyre qe te ngarkohet automatikisht.

Se pari na duhet te gjejme UUID e particionit.

Per kete mund te perdorim utilitetin blkid -o list si me poshte:

[root@localhost student]# blkid -o list
device                                             fs_type         label            mount point                                            UUID
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/dev/sdb1                                          ext4                             /boot                                                  220e3c6e-c730-402f-9b6d-d7d13446d4e7
/dev/sdb2                                          ext4                             /                                                      3ffc3610-2d6b-424a-a723-42b1678b20c6
/dev/sdb3                                          swap                             <swap>                                                 9caf33ea-32ce-4674-9ab1-e9b148dbacb8
/dev/sdb5                                          ext4                             /home                                                  bc67a097-6666-43c7-a082-5c3d9d7cc2ba
/dev/sdc5                                          ext4                             (not mounted)                                          ee092701-28bc-4107-a764-6b267f99de15
[root@localhost student]#

Sic duket me lart particioni /dev/sdc5 i cili eshte i vetmi ne diskun /dev/sdc  qe u formatua nuk eshte i ngarkuar.

Tani duke kopjuar UUI do ta vendosim kete particion ne /etc/fstab

Shtojme particionin ne /etc/fstab me editorin epreferuar te tekstit, duke percaktuar si mount point dosjen /mywork qe e kemi krijuar parprakisht:

[root@localhost student]# cat /etc/fstab

UUID=3ffc3610-2d6b-424a-a723-42b1678b20c6 /                       ext4    defaults        1 1
UUID=220e3c6e-c730-402f-9b6d-d7d13446d4e7 /boot                   ext4    defaults        1 2
UUID=bc67a097-6666-43c7-a082-5c3d9d7cc2ba /home                   ext4    defaults        1 2
UUID=ee092701-28bc-4107-a764-6b267f99de15 /mywork                 ext4    defaults        1 2
UUID=9caf33ea-32ce-4674-9ab1-e9b148dbacb8 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

Shenim
UUID e particionit e kopjuam nga rezultatii komandes blkid -o list

Tani e tutje sa here te ndiqet sistemi do te ngarkoje edhe particionin tone ne path /mywork

Pas reboot:

[root@localhost student]# blkid -o list
device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/sdb5  ext4             /mywork        ee092701-28bc-4107-a764-6b267f99de15
/dev/sda1  ext4             /boot          220e3c6e-c730-402f-9b6d-d7d13446d4e7
/dev/sda2  ext4             /              3ffc3610-2d6b-424a-a723-42b1678b20c6
/dev/sda3  swap             <swap>         9caf33ea-32ce-4674-9ab1-e9b148dbacb8
/dev/sda5  ext4             /home          bc67a097-6666-43c7-a082-5c3d9d7cc2ba
[root@localhost student]#


Fshirja e particioneve

Per te fshire nje particion perdorim opsionin rm <index> te komandes parted si me poshte:

(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2147MB  2146MB  primary

(parted) rm 1                                                            
(parted) print                                                           
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdd: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

(parted) 
 




ċ
devlabel-0.48.03-10.i386.rpm
(32k)
Endrit Xhina,
Mar 7, 2014, 12:38 AM