22
Sun, Dec
3 New Articles

Managing Disks and File Systems on AIX

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Determine the size and type of disks, change a file system size, or add or remove a VG. It's all right here for you.

 

Managing disk or data storage is a common task for system administrators. As data grows on the disks or file systems, you have to expand the storage area. In some cases, you have to reduce storage from one area and give it to another data area. To be able to do this, you must understand the information presented to you when you run any commands related to disk or file system data.

 

In this article, I will cover how to determine the type of disks being used and the size of the disks. I will also demonstrate how to add a disk to or remove a disk from a Volume Group (VG). File systems that are contained in the VGs can also be increased or reduced in their size; this will be demonstrated as well.

 

Assume a couple of new disks have been added to the AIX system. To bring the disks in (and by that I mean to ensure that AIX recognizes each disk and adds it to its internal Object Database Manager (ODM), use this command:

 

# 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 <device>

# 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 <path_to_device>

# 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 <vg_name> <hdiska, hdiskb,..., hdiskn>

 

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 <vg_name>   <hdiska, hdiskb,..., hdiskn>

 

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 <vg_name> <hdiska, hdiskb,..., hdiskn>

 

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=<size_in_units_of_gigabyte|megabyte M|G> /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

Now You Know

In this demonstration, I have shown some of the commands required to determine the size and type of disks. I also explained how to create or remove a VG. Changing a file system size has also been demonstrated. These are the basic tools you need when dealing with simple data storage commands that relate to a VG or file system.

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: