Sayfalar

5 Ocak 2016 Salı

Aix'de file sistem ve disk yönetimi



# cfgmgr



The disks will now be presented as shown below. Use the lspv command to view the disks:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg         active

hdisk2         00525c6a888e32cd                   None

hdisk3         00c23bed32883598                   None


What Type of Disk Is Present

In this example, the new disks come in as hdisk2 and hdisk3. New disks will not necessarily come in sequential order. This is particularly true if the disks use disk slots and you do not populate them one after the other. Notice that the new disks have not yet been assigned to a VG, so the third column states None. We can tell what sort of disk each is by querying the ODM using the lsdev command:



# lsdev -Cc disk

hdisk0 Available 04-08-00-3,0 16 Bit LVD SCSI Disk Drive

hdisk1 Available 04-08-00-4,0 16 Bit LVD SCSI Disk Drive

hdisk2 Available 04-08-00-5,0 16 Bit LVD SCSI Disk Drive

hdisk3 Available 04-08-00-8,0 16 Bit LVD SCSI Disk Drive



The new disks are SCSI disks as are the others.


Disk Sizes: How to Tell

Let's now determine the size of the disks. There are a few methods you can use to see the disk size. Let's look at the most common methods. First, we'll use the lsattr command, which returns device information on the system. The format of the command is this:



lsattr -El < device>



# lsattr -El hdisk2

PCM             PCM/friend/scsiscsd               Path Control Module

False

algorithm       fail_over                        Algorithm

True





size_in_mb     18200                             Size in Megabytes

False

unique_id       21080006CB0A0AST318305LC03IBMscsi Unique device identifier

False



The above lsattr output states that the disk is 18200 MB or 17.7 GB.



You can also use the undocumented command bootinfo. Though this is discouraged by IBM, it will return the usable amount of disk that can be used by the system after formatting. Here's the format of the command:



bootinfo -s

# bootinfo -s hdisk2

17357



The above output states we have a 17357 MB disk or 16.9 GB.



The best and recommended way to determine the size of a disk is to use the getconf command. The getconf will extract the systemwide variables from the kernel. Here's the format:



getconf DISK_SIZE

# getconf DISK_SIZE /dev/hdisk2

17357



In the above output, the getconf returns 17357MB or 16.9 GB.



We have used three commands to get the disk sizes. Two of them agree on the size. Not bad, I guess. To get the correct disk size, use getconf, as this comes from the kernel, the heart of the AIX system.
Creating a Volume Group

For a disk to be used for storage, it needs to be added to an existing VG or a new VG. Let's first add it to a new VG called testvg. The format for the command I am now going to run is this:



mkvg -B -y



here, -B means it should be a big VG. It will be able to have up to 128 disks if required in the VG. The vg_name is the name you are going to call it, followed by a list of hdisks you wish to assign to the VG. Here is the command:



# mkvg -B -y testvg hdisk2

testvg



Viewing the current VGs on the system, we can see that it is present.



# lsvg

rootvg

holdvg

testvg



You can see that hdisk2 is now assigned to the VG testvg. Use the lspv command to confirm:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg        active

hdisk2         00525c6a888e32cd                   testvg         active

hdisk3         00c23bed32883598                   None



You can also query the disks contained in a VG by issuing the lsvg command:



# lsvg -p testvg

testvg:

PV_NAME           PV STATE         TOTAL PPs   FREE PPs   FREE DISTRIBUTION

hdisk2           active           542         542         109..108..108..108..109
Volume Group Maintenance

Let's now add another disk, hdisk3 to the volume group testvg. First, though, determine the disk size:



# getconf DISK_SIZE /dev/hdisk3

70006



It's 70 GB or thereabouts. Now, let's add the disk to the existing VG testvg, using the extendvg comamnd. The format for the command I am now going to run is this:



extendvg   



Here, vg_name is the name of the VG, followed by a list of hdisks you wish to add to the VG. Here's the command:



# extendvg testvg hdisk3



Now let's view the disks and to see what VG is assigned to them. The following output states that hdisk2 and hdisk3 are assigned to the VG testvg:



# lspv

hdisk0         00c23bed42b3aefe                   rootvg         active

hdisk1         00c23bed42b3afff                   rootvg         active

hdisk2         00525c6a888e32cd                   testvg         active

hdisk3         00c23bed32883598                   testvg         active



Now that we've added the extra disk, let's get the size of the VG. In the following output, we can determine the size of the VG by locating the TOTAL PP value (total number of physical partitions on the disks). In this example, it's 87328 MB or 85.2 GB.



# lsvg testvg

VOLUME GROUP:       testvg                   VG IDENTIFIER: 00c23bed00004c00000

0013805b7d417

VG STATE:               active             PP SIZE:       32 megabyte(s)

VG PERMISSION:     read/write               TOTAL PPs:     2729 (87328 megabytes







To calculate the size of the VG, you can also use the following formula, using the values from the above lsvg command:



PP SIZE * TOTAL PP



Like so:

# expr 2729 \* 32

87328



To remove a disk from a VG, first be sure you have removed all data from that disk. You will be warned if there is data on the disk and you try to remove it, which is a good reminder in my books.



Typically, you would unmount any file systems and remove them using the rmfs command on the disk you want to remove. Alternatively, you could use migratepv to literally migrate the data from that disk to another disk contained in that VG. Let's assume all data has been removed from that disk. To remove a hdisk from a VG, use the reducevg command. The format for this example is this:



reducevg



Here, the vg_name is the name of the VG, followed by a list of hdisks you wish to remove from the VG. Here's the command:



# reducevg testvg hdisk2



The VG testvg now has only hdisk3 assigned to it:



# lsvg -p testvg

testvg:

PV_NAME           PV STATE         TOTAL PPs  FREE PPs   FREE DISTRIBUTION

hdisk3           active           2187       1866       438..116..437..437..438
Dynamically Changing File System Sizes

In our VG, we also now have some data. A file system called /data_fs is present with a size of 8 GB. The file system has data residing in it; it's 71% used and has only 2.38 GB of free space left:



# df -g

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on

….

….

/dev/fslv00       8.00     2.38   71%       27     1% /data_fs



That file is getting pretty full, so let's now increase that file system to 12G. The format for increasing or decreasing a file system in GB or MB increments in this example is this:



chfs -a size= /file_filesystem



So to increase the file system from 8 GB to 12 GB, I could use this:



# chfs -a size=12G /data_fs

Filesystem size changed to 25165824



Looking at the newly change file system size, we see the change:



# df -g| grep data_fs

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on



...

/dev/fslv00       12.00     6.38   47%       27     1% /data_fs



Now suppose we wanted to reduce the file system size by 2G, so the new size would be 10G. We could use this:



# chfs -a size=10G /data_fs

Filesystem size changed to 20971520



Let's view the new file system size:



# df -g| grep data_fs

Filesystem   GB blocks     Free %Used   Iused %Iused Mounted on

..

...

/dev/fslv00       10.00     4.38   57%       27     1% /data_fs


 Resource: http://www.mcpressonline.com/unix-/-aix/managing-disks-and-file-systems-on-aix.html
 

Hiç yorum yok:

Yorum Gönder