ADSM-L

Re: [ADSM-L] Re: Orphaned filespaces

2007-04-02 21:31:23
Subject: Re: [ADSM-L] Re: Orphaned filespaces
From: David Bronder <david-bronder AT UIOWA DOT EDU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Mon, 2 Apr 2007 20:30:54 -0500
Allen S. Rout wrote:
>
> # Generate list of "machine-fsid-" for everything in occupancy.
> dsmadmc -id=query -password=query -se=ext2 -dataonly=yes  -tab " select 
> distinct node_name||'-'||cast(filespace_id as character)||'-' from occupancy 
> "  > occ
>
> # Generate list of "machine-fsid-" for every filespace we know.
> dsmadmc -id=query -password=query -se=ext2 -dataonly=yes  -tab " select 
> distinct node_name||'-'||cast(filespace_id as character)||'-' from filespaces 
> " > files
>

The problem I saw here was this:

  ANR2900W The character string '11' was truncated during assignment.

Changing the cast and select a bit could yield output that could in turn
be run to automatically delete those empty filespaces (FSID makes that
easier in the world of different name types).  See below for an update.

The question of whether you _should_ do automatic deletions is another
matter.  I also find the filespace name to be more meaningful to a human
than the FSID, at least if the output is meant for a human to read.


> # Glom them together
> #     sort the glom
> #          Count how many times each unique line happens
> #                Discard those which happen twice.
> cat files occ | sort | uniq -c  | grep -v " 2 "

This inspired me to turn it all into a "one-liner" with no temporary
files, ready (if you're brave) to stuff in a macro or copy/paste into
your admin client:

  ( dsmadmc -id=query -pa=query -dataonly=yes -tab \
     "select distinct 'delete filespace '||node_name||' '||\
      cast(filespace_id as varchar(4))||' namet=fsid' from occupancy" ; \
    dsmadmc -id=query -pa=query -dataonly=yes -tab \
     "select distinct 'delete filespace '||node_name||' '||\
      cast(filespace_id as varchar(4))||' namet=fsid' from filespaces" ) \
  | sort | uniq -c | awk '/^ *1 / { print substr($0, index($0, "delete")) }'


I'm explicitly grabbing lines I know are singles instead of excluding
the doubles; if you get any node/filespace pair 3 or more times, then
something is horribly broken.  :)

Happy deletions...

=Dave  *goes to clean up some more empties...*

--
Hello World.                                    David Bronder - Systems Admin
Segmentation Fault                                     ITS-SPA, Univ. of Iowa
Core dumped, disk trashed, quota filled, soda warm.   david-bronder AT uiowa 
DOT edu

<Prev in Thread] Current Thread [Next in Thread>