Difference between revisions of "ZFS Appliance"
From dbawiki
(Created page with "===List the sizes and available space in all filesystems on ZFS appliance=== * [https://docs.oracle.com/cd/E51475_01/html/E52872/user_interface__cli__scripting__interacting_wi...") |
(→List the sizes and available space in all filesystems on ZFS appliance) |
||
| Line 26: | Line 26: | ||
run('cd ..'); | run('cd ..'); | ||
} | } | ||
| + | . | ||
| + | </pre> | ||
| + | and the same information but "machine readable" sizes | ||
| + | <pre> | ||
| + | script | ||
| + | fmt = '%-40s %-15s %-15s\n'; | ||
| + | printf(fmt, 'SHARE', 'USED', 'AVAILABLE'); | ||
| + | run('cd /'); | ||
| + | run('shares'); | ||
| + | pools = choices('pool'); | ||
| + | for (p = 0; p < pools.length; p++) { | ||
| + | set('pool', pools[p]); | ||
| + | projects = list(); | ||
| + | for (i = 0; i < projects.length; i++) { | ||
| + | run('select ' + projects[i]); | ||
| + | shares = list(); | ||
| + | for (j = 0; j < shares.length; j++) { | ||
| + | run('select ' + shares[j]); | ||
| + | share = pools[p] + ':' + projects[i] + '/' + shares[j]; | ||
| + | printf(fmt, share, get('space_data'), | ||
| + | get('space_available')); | ||
| + | run('cd ..'); | ||
| + | } | ||
| + | run('cd ..'); | ||
| + | } | ||
| + | } | ||
. | . | ||
</pre> | </pre> | ||
Revision as of 15:32, 9 January 2017
List the sizes and available space in all filesystems on ZFS appliance
Make sure to be in the root context before running this.
script
run('shares');
projects = list();
printf('%-40s %-10s %-10s\n', 'SHARE', 'USED', 'AVAILABLE');
for (i = 0; i < projects.length; i++) {
run('select ' + projects[i]);
shares = list();
for (j = 0; j < shares.length; j++) {
run('select ' + shares[j]);
share = projects[i] + '/' + shares[j];
used = run('get space_data').split(/\s+/)[3];
avail = run('get space_available').split(/\s+/)[3];
printf('%-40s %-10s %-10s\n', share, used, avail);
run('cd ..');
}
run('cd ..');
}
.
and the same information but "machine readable" sizes
script
fmt = '%-40s %-15s %-15s\n';
printf(fmt, 'SHARE', 'USED', 'AVAILABLE');
run('cd /');
run('shares');
pools = choices('pool');
for (p = 0; p < pools.length; p++) {
set('pool', pools[p]);
projects = list();
for (i = 0; i < projects.length; i++) {
run('select ' + projects[i]);
shares = list();
for (j = 0; j < shares.length; j++) {
run('select ' + shares[j]);
share = pools[p] + ':' + projects[i] + '/' + shares[j];
printf(fmt, share, get('space_data'),
get('space_available'));
run('cd ..');
}
run('cd ..');
}
}
.