
Default filesystems: Tijdens het installeren van AIX wordt er een standaard VG gemaakt met de volgende filesystemen erin:
JFS: Journaled FileSystem, het standaard filesysteem voor AIX.
Voor meer informatie verwijs ik je naar de uitstekende pagina op wikipedia: http://en.wikipedia.org/wiki/JFS2.
Inode extra info:
Onderstaand verhaal is een standaard verhaal voor inodes onder Unix en Linux. Kleine verschillen kunnen voorkomen per distributie:
Understanding UNIX / Linux filesystem Inodes
The inode (index node) is a fundamental concept in the Linux filesystem. Each object in the filesystem is represented by an inode. But what are the objects? Let us try to understand it in simple words. Each and every file under Linux (and UNIX) has following attributes:
All the above information stored in an inode. In short the inode identifies the file and its attributes (as above) . Each inode is identified by a unique inode number within the file system. Inode is also know as index number.
How do I see file inode number?
> ls -i /etc/passwd
You can also use stat command to find out inode number and its attribute:
> stat /etc/passwd
Find and remove file using find command (necessary with special characters), type the command as follows:
> find . -inum 782263 -exec rm -i {} \;
Wat is een directory dan: Een directory is niets anders dan een tabel met de naam van de bestanden die erin staan en een verwijzing naar het inode nummer van deze bestanden. Indien je geen execute rechten hebt op een directory kun je niet de sprong maken naar de inode tabel en de extra info van de bestanden ophalen. Om een file te verwijderen heb je dus alleen maar lees en execute rechten nodig op de directory, geen rechten op de file zelf.
| Commando | Uitleg |
| lsvg | List all volume groups |
| lsvg -o | List all active volume groups |
| lsvg rootvg | List info over rootvg |
| lsvg -p rootvg | List PVs in de volume group rootvg |
| lsvg -l rootvg | List LVs in de volume group rootvg |
| mkvg | Maak een volume group |
| extendvg | Breidt een volume group uit |
| reducevg | Maakt een volume group kleiner |
| varyoffvg vg1 | Schakelt de volume group vg1 tijdelijk uit |
| varyonvg vg1 | Schakelt de volume group vg1 weer in |
lsvg | lsvg -i | Geeft de info van alle volume groups |
lsvg | lsvg -il | Geeft alle logical volumes van alle volume groups |
lsvg | lsvg -ip | Geeft alle physical volumes van alle volume groups |
| df | Display filesystems |
| df -m | Display filesystems in MB |
| lsfs | List all filesystems |
du /home | sort -r -n | Geeft de grootte van de mappen onder /home weer, grootste eerst |
ls -l | sort +4b -nr | Geeft de grootste file in de huidige directory |
| defragfs | Defragmenteerd het opgegeven filesysteem |
| fsck | Controleert het opgegeven filesysteem |
| mount /tmp | Mount het filesysteem /tmp (/dev/hd3) |
| lspv | List all physical volumes |
| lspv hdisk0 | List info over hdisk0 |
| lspv -l hdisk0 | List all LVs op hdisk0 en hun verspreiding over de schijf |
| lspv -p hdisk0 | List all PPs op hdisk0 en welk LV daar op zit |
| lslv hd1 | List info over het logical volume hd1 |
| lslv -l hd1 | List de mate waarin het LV voldoet aan de policy in percentages |
| lslv -m hd1 | List de fysieke verdeling van het LV over de schijven |
| mklv | Maak een logical volume |
| extendlv hd1 2 | Breidt het logical volume hd1 uit met 2 PPs |
| mklvcopy hd1 2 hdisk1 | Maak een totaal van 2 kopieën van het logical volume hd1 waarbij de nieuwe kopie op hdisk1 komt |
| chlv | Verander een logical volume |
| rmlv hd1 | Verwijder het logical volume hd1 |
| syncvg -l hd1 | Synchroniseer het LV met zijn mirror (-p voor PV en -v voor VG) |
bash-3.00# lsvg -p tempvg
tempvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 799 166 160..00..00..00..06
bash-3.00# reducevg tempvg hdisk2
0516-016 ldeletepv: Cannot delete physical volume with allocated
partitions. Use either migratepv to move the partitions or
reducevg with the -d option to delete the partitions.
0516-884 reducevg: Unable to remove physical volume hdisk2.
bash-3.00# reducevg -d tempvg hdisk2
0516-914 rmlv: Warning, all data belonging to logical volume
fslv04 on physical volume hdisk2 will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)?
y
rmlv: Logical volume fslv04 is removed.
ldeletepv: Volume Group deleted since it contains no physical volumes.
bash-3.00# rmdev -d -l hdisk2
hdisk2 deletedbash-3.00# lspv hdisk1 PHYSICAL VOLUME: hdisk1 VOLUME GROUP: sanvg PV IDENTIFIER: 0001320a6935cee8 VG IDENTIFIER 0001320a0000d4000000011b6935e652 PV STATE: active STALE PARTITIONS: 0 ALLOCATABLE: yes PP SIZE: 128 megabyte(s) LOGICAL VOLUMES: 5 TOTAL PPs: 702 (89856 megabytes) VG DESCRIPTORS: 2 FREE PPs: 4 (512 megabytes) HOT SPARE: no USED PPs: 698 (89344 megabytes) MAX REQUEST: 256 kilobytes FREE DISTRIBUTION: 00..00..00..00..04 USED DISTRIBUTION: 141..140..140..140..137
Achter de regel TOTAL PPs: staat de grootte van de disk in MB
Mogelijkheid 2:
bash-3.00# bootinfo -s hdisk1 150528
Zoals je ziet zit er een verschil tussen de twee schijven. Het onderstaande commando kijkt echt naar de fysieke grootte van de disk, het bovenstaande commando naar de grootte van de disk zoals gedefinieerd in de device database. Om dit uit te breiden moet je onderstaande taak uitvoeren.
# varyoffvg sanvg
# varyonvg sanvg
0516-1434 varyonvg: Following physical volumes appear to be grown in size.
Run chvg command to activate the new space.
hdisk1
# chvg -g sanvg
0516-1164 chvg: Volume group sanvg changed. With given characteristics sanvg
can include upto 16 physical volumes with 2032 physical partitions each.
Je hebt nu de toegevoegde ruimte op het SAN ook daadwerkelijk aan hdisk toegevoegd.
N.B. Dit wordt niet ondersteund voor het rootvg!!!
# lsvg sanvg VOLUME GROUP: sanvg VG IDENTIFIER: 0001320a0000d4000000011b6935e652 VG STATE: active PP SIZE: 128 megabyte(s) VG PERMISSION: read/write TOTAL PPs: 1175 (150400 megabytes) MAX LVs: 256 FREE PPs: 473 (60544 megabytes) LVs: 5 USED PPs: 702 (89856 megabytes) OPEN LVs: 2 QUORUM: 2 TOTAL PVs: 1 VG DESCRIPTORS: 2 STALE PVs: 0 STALE PPs: 0 ACTIVE PVs: 1 AUTO ON: yes MAX PPs per VG: 32512 MAX PPs per PV: 2032 MAX PVs: 16 LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no HOT SPARE: no BB POLICY: relocatable # lslv fslv03 LOGICAL VOLUME: fslv03 VOLUME GROUP: sanvg LV IDENTIFIER: 0001320a0000d4000000011b6935e652.4 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs2 WRITE VERIFY: off MAX LPs: 512 PP SIZE: 128 megabyte(s) COPIES: 1 SCHED POLICY: parallel LPs: 476 PPs: 476 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 32 MOUNT POINT: /var/data LABEL: /var/data MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes Serialize IO ?: NO
Zoals je kunt zien heb je nu in het sanvg 473 PP's vrij. Deze wil je toevoegen aan het logical volume fslv03. Deze mag echter maar 512 PP's bevatten terwijl hij er al 476 heeft. Onderstaand commando verteld je dat ook:
# chfs -a size=121472M /var/data
0516-787 extendlv: Maximum allocation for logical volume fslv03
is 512.
Je moet dus eerst het logical volume aanpassen:
# chlv -x 949 fslv03 # lslv fslv03 LOGICAL VOLUME: fslv03 VOLUME GROUP: sanvg LV IDENTIFIER: 0001320a0000d4000000011b6935e652.4 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs2 WRITE VERIFY: off MAX LPs: 949 PP SIZE: 128 megabyte(s) COPIES: 1 SCHED POLICY: parallel LPs: 949 PPs: 949 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 32 MOUNT POINT: /var/data LABEL: /var/data MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes Serialize IO ?: NO
Je kan nu het filesystem uitbreiden:
# chfs -a size=121472M /var/data Filesystem size changed to 248774656
bash-3.00# lspv hdisk0 0001320a5613aa33 rootvg active hdisk1 0001320a6935cee8 sanvg active hdisk2 none None
Maak eerst een volume groep aan:
bash-3.00# mkvg -y testvg hdisk2 0516-1254 mkvg: Changing the PVID in the ODM. testvg
De schijf heeft nu een PVID gekregen:
bash-3.00# lspv hdisk0 0001320a5613aa33 rootvg active hdisk1 0001320a6935cee8 sanvg active hdisk2 0001320a37f02546 testvg active
Nu moet er nog een filesystem op. Dit doen we met smitty:
Na het maken hoef je hem alleen nog te mounten:
mount /iscsifc
bash-3.00# cat /etc/filesystems
* @(#)filesystems @(#)29 1.22 src/bos/etc/filesystems/filesystems, cmdfs, bos530 9/8/00 13:57:45
* IBM_PROLOG_BEGIN_TAG
* This is an automatically generated prolog.
*
* bos530 src/bos/etc/filesystems/filesystems 1.22
*
* Licensed Materials - Property of IBM
*
* (C) COPYRIGHT International Business Machines Corp. 1985,1993
* All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* IBM_PROLOG_END_TAG
*
* COMPONENT_NAME: CMDFS
*
* FUNCTIONS: none
*
* ORIGINS: 27
*
* (C) COPYRIGHT International Business Machines Corp. 1985, 1993
* All Rights Reserved
* Licensed Materials - Property of IBM
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
*
*
* This version of /etc/filesystems assumes that only the root file system
* is created and ready. As new file systems are added, change the check,
* mount, free, log, vol and vfs entries for the appropriate stanza.
*
/:
dev = /dev/hd4
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
vol = root
free = true
/home:
dev = /dev/hd1
vfs = jfs2
log = /dev/hd8
mount = true
check = true
vol = /home
free = false
/usr:
dev = /dev/hd2
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
vol = /usr
free = false
/var:
dev = /dev/hd9var
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
vol = /var
free = false
/tmp:
dev = /dev/hd3
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
vol = /tmp
free = false
/proc:
dev = /proc
vol = "/proc"
mount = true
check = false
free = false
vfs = procfs
/setup:
dev = /dev/fslv00
vfs = jfs2
log = /dev/hd8
mount = true
account = false
/opt:
dev = /dev/fslv01
vfs = jfs2
log = /dev/loglv00
mount = true
check = false
options = rw
account = false
/var/log:
dev = /dev/fslv02
vfs = jfs2
log = /dev/loglv00
mount = true
check = false
options = rw
account = false
/var/data:
dev = /dev/fslv03
vfs = jfs2
log = /dev/loglv00
mount = true
check = false
options = rw
account = false
Dit bestand is gewoon een text bestand en dus ook als zodanig te bewerken. Maar wijzigingen die je op deze manier maakt worden niet bewaard indien je een export en import doet van de volumegroup waar de filesystems inzitten. Indien je wijzigingen wilt maken die bewaard blijven moet je deze of doen met smitty of met het “chfs” commando. Hieronder worden een aantal opties beschreven:
chfs -p rw /opt chfs -p rw /var/data chfs -p rw /var/log
chfs -A yes /opt chfs -A yes /var/data chfs -A yes /var/log
bash-3.2# chfs -m /var/data1 /var/data bash-3.2# chfs -m /var/backup1 /var/backup bash-3.2# chfs -m /var/dump1 /var/dump bash-3.2# chfs -m /var/log1 /var/log
Change the initiator group in the SAN from iSCSI to FC and:
bash-3.2# lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 638 140 12..00..00..00..128 bash-3.2# lsvg rootvg VOLUME GROUP: rootvg VG IDENTIFIER: 000153ba0000d4000000011ffa8be3fb VG STATE: active PP SIZE: 32 megabyte(s) VG PERMISSION: read/write TOTAL PPs: 638 (20416 megabytes) MAX LVs: 256 FREE PPs: 140 (4480 megabytes) LVs: 10 USED PPs: 498 (15936 megabytes) OPEN LVs: 9 QUORUM: 2 TOTAL PVs: 1 VG DESCRIPTORS: 2 STALE PVs: 0 STALE PPs: 0 ACTIVE PVs: 1 AUTO ON: yes MAX PPs per VG: 32512 MAX PPs per PV: 1016 MAX PVs: 32 LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no HOT SPARE: no BB POLICY: relocatable
As you can see the rootvg consists of one physical disk with a total of 140 free PPs, and each PP is 32 MB big.
Then you can create a filesystem:
bash-3.2# mklv -y cdlv -s n -L /dev/cdlv rootvg 672M hdisk0 cdlv
You'll need a size big enough to support the ISOs you're going to mount. Mine biggest ISO is about 650 MB big, so 672 should be big enough.
bash-3.2# dd if=/tmp/iso/u817522.v1.iso of=/dev/cdlv 1141312+0 records in 1141312+0 records out
Note that this command may take a long time (took me 2 hours) and will create two dd processes:
bash-3.2# ps -ef | grep dd
root 545020 589994 0 09:38:52 pts/3 0:00 dd if=/tmp/iso/u817522.v1.iso of=/dev/cdlv
root 630938 545020 1 09:38:52 pts/3 0:00 dd if=/tmp/iso/u817522.v1.iso of=/dev/cdlv
bash-3.2# mount -v cdrfs -o ro /dev/cdlv /mnt/iso bash-3.2# ls /mnt/iso/ .Version RPMS installp usr
Now the iso is mounted.
bash-3.2# umount /mnt/iso/
bash-3.2# rmlv cdlv Warning, all data contained on logical volume cdlv will be destroyed. rmlv: Do you wish to continue? y(es) n(o)? y rmlv: Logical volume cdlv is removed.
bash-3.00# cd / bash-3.00# umount /test bash-3.00# varyoffvg testvg bash-3.00# exportvg testvg bash-3.00# chdev -l hdisk9 -a queue_depth=1 hdisk9 changed bash-3.00# chdev -l hdisk10 -a queue_depth=1 hdisk10 changed bash-3.00# importvg -y testvg hdisk9 testvg bash-3.00# varyonvg testvg bash-3.00# mount /test bash-3.00# ls /test GroteBestanden KleineBestanden lost+found
root@sanserver:/home/root>sanlun lun show
controller: lun-pathname device filename adapter protocol lun size lun state
netapp2: /vol/sanserver_boot/boot hdisk0 fcs0 FCP 29.9g (32144097280) GOOD
root@sanserver:/home/root>dotpaths -v hdisk0 (path 0): Optimized path - Setting priority to 255 hdisk0 (path 1): Optimized path - Setting priority to 255 Path priority set and/or verified for 1 disks, 2 total paths.
Already prioritized:
root@sanserver:/home/root>dotpaths -v hdisk0 (path 0): Optimized path - Current priority of 255 is correct hdisk0 (path 1): Optimized path - Current priority of 255 is correct Path priority set and/or verified for 1 disks, 2 total paths.
root@sanserver:/home/root>lspath Enabled hdisk0 fscsi0 Enabled hdisk0 fscsi1
root@sanserver:/home/root>sanlun lun show -p ONTAP_PATH: netapp2:/vol/sanserver_boot/boot LUN: 0 LUN Size: 29.9g (32144097280) Host Device: hdisk0 LUN State: GOOD Controller_CF_State: Cluster Enabled Controller Partner: netapp1 Multipath Provider: AIX Native Multipathing Algorithm: round_robin --------- ----------- ------ ------ ----------- ---------- MPIO Controller AIX Controller AIX MPIO path path MPIO host target HBA path status type path HBA port priority --------- ----------- ------ ------ ----------- ---------- Enabled primary path0 fcs0 0b 255 Enabled primary path1 fcs1 0d 255