Monitoring disk space
Command to use
You use the df [option] [pathname] command to monitor the amount of free disk space that is available on one or all volumes on a filer. The amount of space is displayed in 1,024-byte blocks by default. You use the -k, -m, -g, or -t options to have space displayed in KB, MB, GB, or TB format, or you can use the -h option to let Data ONTAP scale the size to the appropriate format, based on the value. The -r option is explained below.
What the command output displays
The output of the df command displays four columns of statistics about the active file system in the volume and the snapshot directory for that volume. Blocks that are referenced by both the active file system and by one or more snapshots are counted only in the active file system (not in the snapshot). The statistics displayed are as follows:
- Amount of total space on the volume
- Amount of used space
- Amount of available space
- Percentage of the volume capacity being used
The -r option changes the last column to report on the amount of reserved space. The amount of reserved space, plus the amount of used space, plus the amount of available space is equal to the amount of total space in the volume.
When the snapshot reserve option is set to zero and snapshots are taken, the amount of space displayed in the total column is larger than what is actually present. The occurs because the space consumed by snapshots is reported as "used" by the active file system in addition to the snapshot.
Example of monitoring disk space
The following example illustrates how to use the df -r command to monitor disk space on a volume throughout a scenario of creating a volume, creating a LUN, writing data to the LUN, taking a snapshot, creating a writable snapshot of the LUN, and creating a clone of that LUN. Assuming that the amount of disk space required for the LUN is 3GB, then thee information from Guidelines to calculate the size of a volume recommends that the volume size be approximately four times 3GB plus the amount of change expected between snapshots. Assuming this rate is approximately 15%, the volume size is calculated as 4*3GB+(3GB*.15*2), or 12.9GB. If the size of the disks you plan to use is 72GB (which typically results in 67.9 GB of physical capacity), two disks provide more than enough space, one for data and one for parity.
This example does not include every step required to properly configure the filer or how to perform tasks on the host.
In the example, the filer is named toaster and the host is named solaris_host. In addition, there are two HBAs installed in the host, lpfc0 (WWNP: 10000000c92f6cd0) and lpfc1 (WWPN:10000000c92f6a24). This information is needed to create an igroup. Also, this example assumes that the original LUN requires 3 GB of disk space.
Step
|
Action
|
|
1 |
From the filer, create a new volume named volspace that has approximately 67 GB and observe the effect on disk space by entering the following commands:
toaster> vol create volspace 2
toaster> df -r /vol/volspace
Result
The following sample output is displayed. There is a snap reserve of 20% on the volume even though the volume will be used for SAN or iSCSI LUNs.
Filesystem kbytes used avail reserved Mounted on
/vol/volspace 50119928 176 50119752 0 /vol/volspace/
/vol/volspace/.snapshot 12529980 0 1252990 0 /vol/vol
space/.snapshot
|
|
2 |
Set the percentage of snap reserve space to zero and observe the effect on disk space by entering the following commands:
toaster> snap reserve volspace 0
toaster> df -r /vol/volspace
Result
The following sample output is displayed. The amount of available snapshot space becomes zero, and the 20% of snapshot space is added to available space for /vol/volspace.
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 176 62649732 62649732 /vol/volspace/
/vol/volspace/.snapshot 0 0 0 0 /vol/vol
space/.snapshot
|
|
3 |
Create a LUN (/vol/volspace/lun0) and observe the effect on disk space by entering the following commands:
toaster> lun create -s 3g -t solaris /vol/volspace/lun0
toaster> df -r /vol/volspace
Result
The following sample output is displayed. Approximately 2GB of space is taken from available space and is displayed as reserved space for the LUN:
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 188 59500908 3148812 /vol/vols
pace/
/vol/volspace/.snapshot 0 0 0 0 /vol/vol
space/.snapshot
|
|
4 |
Create an initiator group named sol-igroup1 and map the LUN to the initiator group by entering the following commands (assuming your host has an HBA whose WWPN is 100000002bcc92). Depending on your host, you may need to create WWNN persistent bindings. These commands have no effect on disk space.
toaster> igroup create -f -t solaris sol-igroup1 10:00:00:00:2b:cc:92 toaster> lun map /vol/volspace/lun0 sol-igroup1 0
|
|
5 |
From the host, discover the LUNs, format them, and make the file system available to the host. For information on these procedures, see the SAN Host Attach Kit Installation and Setup Guide that came with your SAN Host Attach Kit.
|
|
6 |
From the filer, see the effect of creating the filesystem on the LUN by entering the following command:
toaster> df -r /vol/volspace
Result
The following sample output is displayed:
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 183332 59500860 2965716 /vol/vols
pace/
/vol/volspace/.snapshot 0 0 0 0 /vol/vol
space/.snapshot
|
|
7 |
From the host, write data to the file system (the LUN on the filer).
|
|
8 |
From the filer, see the effect of writing to the LUN by entering the following command:
toaster> df -r /vol/volspace
Result
The following sample output is displayed:
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 654632 59500728 2494548 /vol/volsp
ace/
/vol/volspace/.snapshot 0 0 0 0 /vol/vol
space/.snapshot
|
|
9 |
From the host, continue writing data to the file system until the LUN is full.
As you continue writing data to the file system, you can observe the amount of reserved space and available space decrease and used space increase by executing the df -r command.
Result
The following sample output is displayed:
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 2885456 59500004 264448 /vol/volspa
ce/
/vol/volspace/.snapshot 0 0 0 0 /vol/vol
space/.snapshot
|
|
10 |
Take a snapshot named snap1 of the active file system and observe the effect on disk space.
Caution From the host or the application, ensure that the active file system is in a quiesced or synchronized state prior to taking a snapshot.
Enter the following commands:
toaster> snap create volspace snap1
toaster> df -r /vol/volspace
Result
The following sample output is displayed. The amount of reserved space increases to approximately 3 GB to ensure that in addition to being able to write data to the LUN, data in the snapshot can be overwritten as well because when Data ONTAP writes to a block of snapshotted data, both the old data and the new data must be stored. In this example, 722 KB of space is used for the snapshot.
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 2885652 56615440 3148816 /vol/volspace/
/vol/volspace/.snapshot 0 772 0 0 /vol/vol
space/.snapshot
|
|
11 |
Create a writable snapshot of LUN0 named snaplun and observe the effect on disk space by entering the following commands:
toaster> lun create -b /vol/volspace/.snapshot/snap1/lun0 /vol/volspace/snaplun
Note After you create this LUN, you must go through the same procedure on the host to discover the new LUN, format it, and so on, except for creating a new file system on it.
toaster> df -r /vol/volspace
Result
The following sample output is displayed. The amount of reserved space increases to approximately 6 GB to ensure that both LUNs can be written to, and a small amount of space is increased for the snapshot.
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 2886408 53465868 6297632 /vol/volspace/
/vol/volspace/.snapshot 0 792 0 0 /vol/vol
space/.snapshot
|
|
12 |
Display the status of both LUNs by entering the following command:
toaster> lun show -v
Result
The following sample output is displayed:
/vol/volspace/lun0 3g (3221225472) (r/w, online, mapped)
Serial#: 0dDICn1A-Z0J
Share: none
Space Reservation: enabled
Multiprotocol Type: solaris
Maps: sol-igroup1=0
/vol/volsapce/snaplun 3g (3221225472) (r/w, online)
Serial#: 0dDICn1RRA0J
Backed by: /vol/volspace/.snapshot/snap1/lun0
Share: none
Space Reservation: enabled
Multiprotocol Type: solaris
Maps: sol-igroup1=0
|
|
13 |
Create a clone of the writable snapshot of the LUN you created in step 11 and observe the effect on disk space by entering the following commands:
toaster> lun clone start /vol/volspace/snaplun
toaster> df -r /vol/volspace
Result
The following sample output is displayed. The amount of used space increases to 45 GB, available space decreases, and again, a small amount of space is used by snapshot.
Filesystem kbytes used avail reserved Mounted on
/vol/volspace/ 62649908 4538176 51814100 6297632 /vol/volspace/
/vol/volspace/.snapshot 0 860 0 0 /vol/vol
space/.snapshot
|
.
The effect of LUN and snapshot operations on disk space
The following table is another example of monitoring disk space. It illustrates the effect on disk space when you create a volume, create a LUN, write data to the LUN, take snapshots of the LUN, and expand the size of the volume. For this example, assume space reservation is enabled and snap reserve is set to 0%.
Action
|
Result
|
Comment
|
Create a 100-GB volume.
|
Used space = 0 GB Reserved space = 0 GB Available space = 100 GB Volume Total: 100 GB
Snapshot creation is allowed.
|
|
Create a 40-GB LUN on that volume.
|
Used space = 0 Reserved space = 40 Available space = 60 GB Volume Total: 100 GB
Snapshot creation is allowed.
|
If the LUN size was limited to accommodate at least one snapshot when it was created, then it will always be less than one half of the volume size.
|
Write 40 GB of data to the LUN.
|
Used space = 40 GB Reserved space = 0 GB Available space = 60 GB Volume Total: 100 GB
Snapshot creation is allowed.
|
When you write data to the LUN, it counts against the running Used total. The sum of Used, Reserved, and Available always equals Volume Total.
|
Create a snapshot of the LUN.
|
Used space = 40 GB Reserved space = 40 GB Available space = 20 GB Volume Total: 100 GB
Snapshot succeeds.
|
The snapshot locks all the data on the LUN so that even if that data is later deleted, it remains in the snapshot until the snapshot is deleted.
After a snapshot is created, the reserved space must now be large enough to ensure that any future writes to the LUN succeed.
|
Overwrite all 40 GB of data on the LUN with new data.
|
Used space = 60 GB Reserved space = 40 GB Available space = 0 GB Volume Total: 100 GB
Snapshot creation is blocked.
|
The amount of used space on the volume increases, because the original 40 GB of data belongs to the snapshot and therefore continues to count against the Used total. Reserved space must be equal to the size of the LUN (40 GB), and reserved and used space together cannot exceed the size of the volume. As a result, used space is displayed as 60 GB rather than the expected 80 GB. However, all data is preserved.
You cannot take a snapshot now, because no space is available. That is, all space is used by data or held in reserve so that any and all changes to the content of the LUN can be written to the volume.
|
Expand the volume by 100 GB.
|
Used space = 80 GB Reserved space = 40 GB Available space = 80 GB Volume Total: 200 GB
Snapshot creation is allowed.
|
After you expand the volume, free space becomes available again. Therefore, snapshot creation is no longer blocked.
In addition, the Used and Available totals are adjusted to reflect the fact that reserved space is no longer being used to hold disk data.
|
Overwrite all 40 GB of data on the LUN with new data.
|
Used space = 80 GB Reserved space = 40 GB Available space = 80 GB Volume Total: 200 GB
Snapshot creation is allowed.
|
Because none of the overwritten data belongs to a snapshot, it disappears when the new data replaces it. As a result, the Used total remains unchanged.
|
Create a snapshot of the LUN.
|
Used space = 80 GB Reserved space = 40 GB Available space = 80 GB Volume Total: 200 GB
Snapshot creation is allowed.
|
The snapshot locks all 40 GB of data currently on the LUN. A total of 80 GB of data now belongs to the two snapshots of the LUN.
Reserved space remains the size of the LUN, or 40 GB.
|
Overwrite all 40 GB of data on the LUN with new data.
|
Used space = 120 GB Reserved space = 40 GB Available space = 40 GB Volume Total: 200 GB
Snapshot creation is allowed.
|
Because the data being replaced belongs to a snapshot, it remains on the volume.
|
Expand the LUN by 40 GB.
|
Used space = 120 GB Reserved space = 80 GB Available space = 0 GB Volume Total: 200 GB
Snapshot creation is blocked.
|
The amount of reserved space increases to match the expanded size of the LUN. This guarantees that the entire contents of the LUN can be written to the volume. Because the available space has decreased to 0, snapshot creation is blocked.
|
Delete both snapshots of the volume.
|
Used space = 80 GB Reserved space = 40 GB Available space = 0 GB Volume Total: 200 GB
Snapshot creation is allowed.
|
The 80 GB of data locked by the two snapshots disappears from the Used total when the snapshots are deleted. Because there are no more snapshots of this LUN, the reserved space decreases to 40 GB, enough to guarantee any future write operations. Snapshot creation is once again allowed.
|
Delete the LUN.
|
Used space = 0 GB Reserved space = 0 GB Available space = 200 GB Volume Total: 200 GB
|
Because no snapshots exist for this volume, deletion of the LUN causes the Used space to decrease to 0 GB.
|
Copyright © 1994-2003, Network Appliance, Inc. All rights
reserved.
Part No. 210-00570
File: c3lunmg5.htm
Last updated: 09/03/03 17:13:48