<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script help (Optimizing Disk-Usage/Allocation) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787456#M78741</link>
    <description>Hi, if i have some time today, i'll try to write i nice script for you. But have you seen that the /fs36/nwdv.fw.1 23148320 is too big for a 18Gb disk.. what to do about this one?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan&lt;BR /&gt;</description>
    <pubDate>Fri, 16 Aug 2002 07:35:13 GMT</pubDate>
    <dc:creator>Ceesjan van Hattum</dc:creator>
    <dc:date>2002-08-16T07:35:13Z</dc:date>
    <item>
      <title>Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787455#M78740</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've attached a file in this message. The file contains 2 columns, denoting the name of the filesystem and its disk-usage (du). &lt;BR /&gt;&lt;BR /&gt;I would like to calculate the disk-usage sizes of the filesystems. If the accumulated value is less than 18000000KB(18GB), place the names of those filesystems into separate files. The files represent the allocation of a disk to several filesystems not exceeding 18GB. &lt;BR /&gt;&lt;BR /&gt;e.g:&lt;BR /&gt;/fs24/nwdv...     3092416&lt;BR /&gt;/fs26/nwdv...    13909787&lt;BR /&gt;/fs27/nwdv...     7899088&lt;BR /&gt;/fs34/nwdv...     6789123&lt;BR /&gt;/fs12/circuit...   189087&lt;BR /&gt;&lt;BR /&gt;From the example above, hence /fs24 and /fs26 are to be placed in file_DISK1, /fs27 and /fs34 are to be placed into file_DISK2 and  the next lists should be in file_DISKn (n=1...x). &lt;BR /&gt;&lt;BR /&gt;Also, if there are sufficient disk-space remaining in a disk, after placing the current filesystems in it, I would like to have the smaller sized filesystem(s) placed into the first instance of those particular disks, i.e by appending the name of that filesystem into a file which contains other filesystem list.&lt;BR /&gt;e.g /fs12/circuit... could be appended into file_DISK1&lt;BR /&gt;&lt;BR /&gt;I'm not sure I should do this in AWK, or even other methods of shell scripts.&lt;BR /&gt;&lt;BR /&gt;Could someone please help me out? &lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 06:09:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787455#M78740</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-16T06:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787456#M78741</link>
      <description>Hi, if i have some time today, i'll try to write i nice script for you. But have you seen that the /fs36/nwdv.fw.1 23148320 is too big for a 18Gb disk.. what to do about this one?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 07:35:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787456#M78741</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-08-16T07:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787457#M78742</link>
      <description>Ceesjan,&lt;BR /&gt;Thanks for your offer to show me the script. &lt;BR /&gt;&lt;BR /&gt;For the case of /fs36/nwdv.fm.1 having disk usage of 23148320KB (23GB), I would like to have it placed into another disk i.e into another file called file_DISK_UNIQUE. &lt;BR /&gt;&lt;BR /&gt;As for the rest, if their sum does not exceed 18000000KB(18GB), then place them into a file_DISKn (n=1....x)&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 08:56:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787457#M78742</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-16T08:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787458#M78743</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The following perl script should do what you want.  Change $loc to where you want the files stored.  Change your perl location in line1.&lt;BR /&gt;&lt;BR /&gt;Run it with your filename as the only argument, e.g:&lt;BR /&gt;&lt;BR /&gt;yourscript.pl disk-size-file&lt;BR /&gt;&lt;BR /&gt;============================================&lt;BR /&gt;#!/opt/perl5/bin/perl&lt;BR /&gt;&lt;BR /&gt;my $infile=$ARGV[0];&lt;BR /&gt;my $loc="/tmp/file_DISK_";&lt;BR /&gt;my $eighteengig=18*1024*1024;&lt;BR /&gt;my ($i,$j,$disk,$size,$file,$suffix);&lt;BR /&gt;my (@sizes,@disks);&lt;BR /&gt;&lt;BR /&gt;open IN,$infile;&lt;BR /&gt;while (&lt;IN&gt;) {&lt;BR /&gt; chomp;&lt;BR /&gt; next unless (m+^/+);&lt;BR /&gt; ($disk,$size)=split;&lt;BR /&gt; for ($j=0;$j&amp;lt;=$i;$j++){&lt;BR /&gt;  next if ( ($sizes[$j]+$size) &amp;gt; $eighteengig );&lt;BR /&gt;  $sizes[$j]+=$size;&lt;BR /&gt;  $disks[$j].="$disk|";&lt;BR /&gt;  last;&lt;BR /&gt; }&lt;BR /&gt; if ( $j &amp;gt; $i ) {&lt;BR /&gt;  $i++;&lt;BR /&gt;  $sizes[$j]=$size;&lt;BR /&gt;  $disks[$j].="$disk|";&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;close IN;&lt;BR /&gt;for ($j=0;$j&amp;lt;=$i;$j++){&lt;BR /&gt; if ( $sizes[$j] &amp;gt; $eighteengig ) {&lt;BR /&gt;  $file=$loc."UNIQUE";&lt;BR /&gt; } else {&lt;BR /&gt;  $suffix++;&lt;BR /&gt;  $file=$loc.$suffix;&lt;BR /&gt; }&lt;BR /&gt; open FH,"&amp;gt;&amp;gt; $file";&lt;BR /&gt; foreach $disk ( split /\|/,$disks[$j] ) {&lt;BR /&gt;  print FH "$disk\n";&lt;BR /&gt; }&lt;BR /&gt; close FH;&lt;BR /&gt;}&lt;BR /&gt;============================================&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.&lt;/IN&gt;</description>
      <pubDate>Fri, 16 Aug 2002 09:59:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787458#M78743</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-08-16T09:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787459#M78744</link>
      <description>Hi again,&lt;BR /&gt;Here is my script, but there are a few things you should know:&lt;BR /&gt;1. 18G = 18*1024*1024=18874368, but i would not go further than 90% of this.&lt;BR /&gt;2. The scripts calculates the disks sequentially. If a disk is full, go to the next. A good program should have a recursive-backtracking mechanisme, to find all possible combinations.&lt;BR /&gt;&lt;BR /&gt;Here the script and it's output:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN{disknr=1;oldsum=0}&lt;BR /&gt;     {&lt;BR /&gt;      fs=$1"\n"oldfs&lt;BR /&gt;      sum=oldsum+$2;&lt;BR /&gt;      if (sum&amp;gt;18874368) {&lt;BR /&gt;                   sum=oldsum;&lt;BR /&gt;                   fs=oldfs;&lt;BR /&gt;                   if (sum&amp;gt;18874368) {&lt;BR /&gt;                        printf "DISC_UNIQUE=%d\nSIZE: %d\nFILESYSTEMS:\n%s\n\n",&lt;BR /&gt;disknr,sum,fs }&lt;BR /&gt;                   else printf "DISC=%d\nSIZE: %d\nFILESYSTEMS:\n%s\n\n",disknr,&lt;BR /&gt;sum,fs&lt;BR /&gt;                   disknr=disknr+1;&lt;BR /&gt;                   oldsum=0&lt;BR /&gt;                   sum=$2&lt;BR /&gt;                   fs=$1&lt;BR /&gt;                   }&lt;BR /&gt;      oldsum=sum&lt;BR /&gt;      oldfs=fs&lt;BR /&gt;}END{&lt;BR /&gt; sum=oldsum+$2;&lt;BR /&gt; printf "DISC=%d\nSIZE: %d\nFILESYSTEMS:\n%s\n\n",disknr,sum,fs&lt;BR /&gt;}' input&lt;BR /&gt;&lt;BR /&gt;The output:&lt;BR /&gt;&lt;BR /&gt;DISC=1&lt;BR /&gt;SIZE: 14812480&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs34/nwdv.sfv.1&lt;BR /&gt;/fs37/nwdv.dfm.1&lt;BR /&gt;/fs34/nwdv.des.clk.1&lt;BR /&gt;/fs36/nwdv.des.clk.2&lt;BR /&gt;/fs34/cad.athena.linux_rsaix&lt;BR /&gt;/fs37/nwdv.dfm.2&lt;BR /&gt;&lt;BR /&gt;DISC=2&lt;BR /&gt;SIZE: 18451956&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs34/nwdv.apv.fctdb.1&lt;BR /&gt;/fs34/nwdv.apv.bctl.1&lt;BR /&gt;/fs36/nwdv.des.mem.1&lt;BR /&gt;/fs36/nwdv.des.bctl.5&lt;BR /&gt;/fs36/nwdv.fw.2&lt;BR /&gt;&lt;BR /&gt;DISC=3&lt;BR /&gt;SIZE: 18830712&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs12/wmt.av.1&lt;BR /&gt;/fs37/nwdv.dft.3&lt;BR /&gt;/fs37/nwdv.toolutils.dev.1&lt;BR /&gt;/fs34/nwdv.fcnet.1&lt;BR /&gt;/fs31/nwd.uav.2&lt;BR /&gt;/fs34/nwdv.shark.2&lt;BR /&gt;/fs34/nwdv.uav.2&lt;BR /&gt;/fs34/nwdv.des.bctl.3&lt;BR /&gt;/fs15/wmt.uav.2&lt;BR /&gt;/fs36/nwdv.dft.1&lt;BR /&gt;/fs12/wmt.dv.4&lt;BR /&gt;/fs12/wmt.uav.1&lt;BR /&gt;/fs16/wmt.dv.7&lt;BR /&gt;/fs34/nwdv.des.noise.2&lt;BR /&gt;/fs34/nwdv.sfv.3&lt;BR /&gt;/fs36/nwdv.apv.bctl.2&lt;BR /&gt;/fs37/nwdv.uav.6&lt;BR /&gt;/fs37/nwdv.cad.linux.1&lt;BR /&gt;/fs37/nwdv.dft.4&lt;BR /&gt;/fs34/nwdv.rvcr.4&lt;BR /&gt;/fs34/nwdv.rvcr.3&lt;BR /&gt;/fs34/nwdv.powrv.2&lt;BR /&gt;/fs34/nwdv.apv.ul1.2&lt;BR /&gt;/fs34/nwdv.apv.ul1.1&lt;BR /&gt;/fs34/nwdv.apv.fctdb.3&lt;BR /&gt;/fs34/nwdv.apv.fctdb.2&lt;BR /&gt;&lt;BR /&gt;DISC=4&lt;BR /&gt;SIZE: 16367912&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs34/nwdv.rvcr.5&lt;BR /&gt;/fs28/nwd.des.clk.1&lt;BR /&gt;/fs36/nwdv.powerv.1&lt;BR /&gt;/fs36/nwdv.uav.3&lt;BR /&gt;/fs36/nwdv.da.maskpe.2&lt;BR /&gt;/fs24/wmt.des.noise.6&lt;BR /&gt;/fs36/nwdv.dft.2&lt;BR /&gt;&lt;BR /&gt;DISC=5&lt;BR /&gt;SIZE: 16841608&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs36/nwdv.des.erc.1&lt;BR /&gt;/fs37/nwdv.des.noise.9&lt;BR /&gt;/fs12/wmt.common.1&lt;BR /&gt;/fs12/wmt.pcg.1&lt;BR /&gt;/stor/nwd_lay3&lt;BR /&gt;&lt;BR /&gt;DISC=6&lt;BR /&gt;SIZE: 18466720&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs34/nwdv.rvcr.2&lt;BR /&gt;/fs34/nwdv.sfv.2&lt;BR /&gt;/fs34/nwdv.rtl.mem.1&lt;BR /&gt;/fs12/wmt.ucode.1&lt;BR /&gt;&lt;BR /&gt;DISC=7&lt;BR /&gt;SIZE: 14505804&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs13/wmt.rtl.1&lt;BR /&gt;/fs36/nwdv.rtl.bus.1&lt;BR /&gt;/fs34/nwdv.rvcr.1&lt;BR /&gt;&lt;BR /&gt;DISC=8&lt;BR /&gt;SIZE: 10303388&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs36/nwdv.apv.frz.6&lt;BR /&gt;/fs34/nwdv.powrv.1&lt;BR /&gt;&lt;BR /&gt;DISC_UNIQUE=9&lt;BR /&gt;SIZE: 23148320&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs36/nwdv.fw.1&lt;BR /&gt;&lt;BR /&gt;DISC=10&lt;BR /&gt;SIZE: 18441472&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs36/nwdv.cr.7&lt;BR /&gt;/fs36/nwdv.cr.8&lt;BR /&gt;/fs16/wmt.bav.1&lt;BR /&gt;&lt;BR /&gt;DISC=11&lt;BR /&gt;SIZE: 14120864&lt;BR /&gt;FILESYSTEMS:&lt;BR /&gt;/fs36/nwdv.da.fubpv.1&lt;BR /&gt;&lt;BR /&gt;------&lt;BR /&gt;Regards&lt;BR /&gt;Ceesjan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2002 10:21:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787459#M78744</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-08-16T10:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787460#M78745</link>
      <description>Ceesjan &amp;amp; Robin,&lt;BR /&gt;&lt;BR /&gt;Thanks so much the effort. I really appreciate it.&lt;BR /&gt;&lt;BR /&gt;Ceesjan,&lt;BR /&gt;Need to clarify some parts of the script:&lt;BR /&gt;awk 'BEGIN{disknr=1;oldsum=0} &lt;BR /&gt;{ &lt;BR /&gt;fs=$1"\n"oldfs &lt;BR /&gt;sum=oldsum+$2; &lt;BR /&gt;if (sum&amp;gt;18874368) { &lt;BR /&gt;sum=oldsum; &lt;BR /&gt;fs=oldfs; &lt;BR /&gt;   if (sum&amp;gt;18874368) {  ....(1)&lt;BR /&gt;      printf "DISC_UNIQUE=%d\nSIZE: %   d\nFILESYSTEMS:\n%s\n\n", &lt;BR /&gt;disknr,sum,fs &lt;BR /&gt;   } &lt;BR /&gt;   else {&lt;BR /&gt;      printf "DISC=%d\nSIZE: %d\nFILESYSTEMS:\n%s\n\n",disknr, &lt;BR /&gt;sum,fs      ....(2)&lt;BR /&gt;   }&lt;BR /&gt;   disknr=disknr+1;  &lt;BR /&gt;   oldsum=0 &lt;BR /&gt;   sum=$2  ... (3)  &lt;BR /&gt;   fs=$1   ... (4)&lt;BR /&gt;} &lt;BR /&gt;oldsum=sum  ...(5)&lt;BR /&gt;oldfs=fs    ...(6)&lt;BR /&gt;}&lt;BR /&gt;END{ &lt;BR /&gt;sum=oldsum+$2;   ...(7)&lt;BR /&gt;printf "DISC=%d\nSIZE: %d\nFILESYSTEMS:\n%s\n\n",disknr,sum,fs  ...(8) &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;From the lines marked (1)-(8), I understand in (1), you're checking for filesystem with size 23148320KB (23GB). &lt;BR /&gt;Could you please explain the process on how have the names of the filesystem were saved into the appropriate disk, whenever sum is checked against the threshold ? &lt;BR /&gt;&lt;BR /&gt;i.e which part of the script shows that whenever a sum &amp;lt; threshold, current files are saved into the appropriate disk?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Sun, 18 Aug 2002 09:35:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787460#M78745</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-18T09:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787461#M78746</link>
      <description>Hi, the script is a little tricky, and not perfect as i see now.. but understandable:&lt;BR /&gt;&lt;BR /&gt;First i tried to get the structure of 'sum','oldsum' and '$2' correct.. this is just addition of numbers..&lt;BR /&gt;The same as you can add number, you can add strings: fs=oldfs+$1 is just a longer string. I put \n inbetween to make the output look more nice: fs=oldfs"\n"$1.&lt;BR /&gt;So really, the sum and fs are on all places doing the same, it adds when it adds and resets when it resets..&lt;BR /&gt;&lt;BR /&gt;To understand the script, now forget about the fs and only concentrate on the variable sum.&lt;BR /&gt;&lt;BR /&gt;In the body of awk, you see that sum always adds the new $2. Whether or not the value gets to high..&lt;BR /&gt;If it was NOT to high, it will not enter the nested if, and oldsum=sum (as a memory variable).&lt;BR /&gt;&lt;BR /&gt;If the sum gets too high (no matter unique or not unique), sum will be set to $2 and disknr will increase along.&lt;BR /&gt;&lt;BR /&gt;So, if sum gets the value of $2, it can get a value of 23G.  Out of the if's, oldsum=sum, so oldsum will be 23G as well. &lt;BR /&gt;So the next round, sum=23+next record.&lt;BR /&gt;First if-stat: too high: sum=oldsum=23..&lt;BR /&gt;In this case 'sum' is set back to oldsum, but still too high.. therefor unique-label.&lt;BR /&gt;&lt;BR /&gt;In other words, the script always looks ahead.. and evaluates wheter or not the actions were correct or not..&lt;BR /&gt;&lt;BR /&gt;I see now that the script can go wrong, if the big fs will be the first of the inputlist.&lt;BR /&gt;&lt;BR /&gt;Once i finished the algorithm, i just added fs,oldfs and $1 on the same places as sum,oldsum and $2.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan&lt;BR /&gt;</description>
      <pubDate>Sun, 18 Aug 2002 14:42:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787461#M78746</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-08-18T14:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787462#M78747</link>
      <description>Ceesjan,&lt;BR /&gt;&lt;BR /&gt;Thanks for replying my message. I think I need more clarifications on which portion of the script which "saves" or keeps track of all filesystems to be allocated into the proper disk? i.e as in the output below:&lt;BR /&gt;DISC=1 &lt;BR /&gt;SIZE: 14812480 &lt;BR /&gt;FILESYSTEMS: &lt;BR /&gt;/fs34/nwdv.sfv.1 &lt;BR /&gt;/fs37/nwdv.dfm.1 &lt;BR /&gt;/fs34/nwdv.des.clk.1 &lt;BR /&gt;/fs36/nwdv.des.clk.2 &lt;BR /&gt;/fs34/cad.athena.linux_rsaix &lt;BR /&gt;/fs37/nwdv.dfm.2 &lt;BR /&gt;&lt;BR /&gt;DISC=2 &lt;BR /&gt;SIZE: 18451956 &lt;BR /&gt;FILESYSTEMS: &lt;BR /&gt;/fs34/nwdv.apv.fctdb.1 &lt;BR /&gt;/fs34/nwdv.apv.bctl.1 &lt;BR /&gt;/fs36/nwdv.des.mem.1 &lt;BR /&gt;/fs36/nwdv.des.bctl.5 &lt;BR /&gt;/fs36/nwdv.fw.2 &lt;BR /&gt;&lt;BR /&gt;It seems to be that the oldfs is always overwritten by fs whenever sum&amp;lt;18874368 or when sum&amp;gt;18874368. How is it that oldfs manages to retain all values of the filesystem list to be placed into the proper disk?&lt;BR /&gt;&lt;BR /&gt;I'm still new to AWK and other scripting languages.&lt;BR /&gt;&lt;BR /&gt;Could you help me out, please?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2002 00:04:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787462#M78747</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-19T00:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787463#M78748</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I was wondering if anyone could show me on how I could modify Ceesjan's script to ensure that the allocation of all filesystems to the disk would ensure that all disks are utilized to it's fullest, as possible? &lt;BR /&gt;&lt;BR /&gt;I'm trying to reduce the number of "disk" usage.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 19 Aug 2002 02:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787463#M78748</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-19T02:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787464#M78749</link>
      <description>Hi,&lt;BR /&gt;My script is not the best, it sequentially goes trough the lines of the inputfile. It takes a disk, if the fs can be put on the disk then continue, otherwise take the next empty disk.&lt;BR /&gt;&lt;BR /&gt;In other words, the script doesn't really think and doesn't really memorize, it just adds all fs's and starts from 0 if total exceeds 18G.&lt;BR /&gt;So.. it is NO guarantee that the ouput is the most optimal.&lt;BR /&gt;&lt;BR /&gt;just a hint:&lt;BR /&gt;awk 'BEGIN{}{..body..}END{}' input &amp;gt; output&lt;BR /&gt;BEGIN is executed before reading input&lt;BR /&gt;END is executed after reading input&lt;BR /&gt;..body.. is executed for each line of input ($1, $2, $3...NF)&lt;BR /&gt;&lt;BR /&gt;To find the optimal diskconfig, you should know all fs's first, before any calculation. My script start the calculations already, before even knowing what the other fs's look like..&lt;BR /&gt;&lt;BR /&gt;If you want to have the most optimal config, then you should read all input first in an array and use an intelligent algorithm, not mine.&lt;BR /&gt;..or you still can use my script, but run it on all permutations of the inputfile: 63 lines makes 63! = 1.98*10^87 possible input combination.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2002 06:39:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787464#M78749</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-08-19T06:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787465#M78750</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;fwiw, I have converted the perl script to awk:&lt;BR /&gt;&lt;BR /&gt;===============================================&lt;BR /&gt;BEGIN {&lt;BR /&gt; eighteengig=18*1024*1024&lt;BR /&gt; loc="/tmp/file_DISK_"&lt;BR /&gt;}&lt;BR /&gt;/^\//{&lt;BR /&gt; disk=$1;size=$2&lt;BR /&gt; for (j=0;j&amp;lt;=i;j++) {&lt;BR /&gt;  if (sizes[j]+size &amp;gt; eighteengig ) {continue}&lt;BR /&gt;  sizes[j]+=size&lt;BR /&gt;  disks[j]=disks[j] disk "|"&lt;BR /&gt;  break&lt;BR /&gt; }&lt;BR /&gt; if (j&amp;gt;i) {&lt;BR /&gt;  i++&lt;BR /&gt;  sizes[j]=size&lt;BR /&gt;  disks[j]=disks[j] disk "|"&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;END {&lt;BR /&gt; for (j=0;j&amp;lt;=i;j++) {&lt;BR /&gt;  print "j=" j " i=" i&lt;BR /&gt;  if ( sizes[j] &amp;gt; eighteengig ) {&lt;BR /&gt;   file=loc"UNIQUE"&lt;BR /&gt;  } else {&lt;BR /&gt;   suffix++&lt;BR /&gt;   file=loc suffix&lt;BR /&gt;  }&lt;BR /&gt;  n=split(disks[j],darray,"|")&lt;BR /&gt;  print "n=" n&lt;BR /&gt;  for (m=1;m&lt;N&gt;&lt;/N&gt;   print darray[m] &amp;gt;&amp;gt; file&lt;BR /&gt;   close file&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;==============================================&lt;BR /&gt;&lt;BR /&gt;so you run it using:&lt;BR /&gt;&lt;BR /&gt;awk -f scriptname disk-size-file&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Mon, 19 Aug 2002 07:33:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787465#M78750</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-08-19T07:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787466#M78751</link>
      <description>Robin,&lt;BR /&gt;&lt;BR /&gt;Thanks for converting the script to an AWK script. &lt;BR /&gt;&lt;BR /&gt;I was wondering if you could tell me where/what is the variable 'i' defined as? (refer to script portion below):&lt;BR /&gt;&lt;BR /&gt;disk=$1;size=$2 &lt;BR /&gt;for (j=0;j&amp;lt;=i;j++) {    ...(1) &lt;BR /&gt;if (sizes[j]+size &amp;gt; eighteengig ) {continue} &lt;BR /&gt;sizes[j]+=size &lt;BR /&gt;disks[j]=disks[j] disk "|" &lt;BR /&gt;break &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;And what does this symbol mean?:&lt;BR /&gt;/^\//  &lt;BR /&gt;&lt;BR /&gt;What is the purpose of these lines below?:&lt;BR /&gt;if (j&amp;gt;i) { &lt;BR /&gt;i++ &lt;BR /&gt;sizes[j]=size &lt;BR /&gt;disks[j]=disks[j] disk "|" &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sorry for asking too much as I'm rather new to scripting.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Aug 2002 09:20:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787466#M78751</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-08-20T09:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script help (Optimizing Disk-Usage/Allocation)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787467#M78752</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;1. If a numeric variable is undefined, it automatically defaults to a value of 0, which is what I want.  A string will default to the empty string "".&lt;BR /&gt;&lt;BR /&gt;2. /\^// simply means match an input line that begins with a slash.  The outer "/" characters are the pattern match delimiters, the "^" means match the beginning of the line, and the "/" following it is what I'm looking for.&lt;BR /&gt;&lt;BR /&gt;3. If the previous for{} loop drops through without doing anything, it means that none of the existing array values can hold the new disk size, otherwise they'd go over the 18Gb limit.  Therefore if this happens, j will be greater than i, so increment i (which will now equal the current value of j), and start a new array index, which will hold the disk size that is being processed.&lt;BR /&gt;&lt;BR /&gt;Hope that doesn't sound too complicated.  Put some print statements in to see what it's doing!!&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 22 Aug 2002 06:36:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-optimizing-disk-usage-allocation/m-p/2787467#M78752</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-08-22T06:36:58Z</dc:date>
    </item>
  </channel>
</rss>

