Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3056
  • Last Modified:

Converting Blocks to Size (in Solaris)

Hello,

Given below is the 'metastat' output of a mirrored volume. Having this output, how can I calculate the actual size of the volume in MB or GB?  How can I determine the size of each block? Please let me know.

root@insitedb1# metastat d1
d1: Mirror
    Submirror 0: d11
      State: Okay
    Submirror 1: d31
      State: Okay
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 23164002 blocks                              <-----------------------------

d11: Submirror of d1
    State: Okay
    Size: 23164002 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t0d0s1                   0     No    Okay


d31: Submirror of d1
    State: Okay
    Size: 23164002 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t3d0s1                   0     No    Okay

root@insitedb1#
root@insitedb1# prtvtoc /dev/rdsk/c1t0d0s1
* /dev/rdsk/c1t0d0s1 partition map
*
* Dimensions:
*     512 bytes/sector
*     107 sectors/track
*      27 tracks/cylinder
*    2889 sectors/cylinder
*   24622 cylinders
*   24620 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0   9533700   9533699
       1      3    01    9533700  23164002  32697701                     <-------------------
       2      5    00          0  71127180  71127179
       3      7    00   32697702  28890000  61587701
       4      0    00   61587702   9533700  71121401
       6      0    00   71121402      2889  71124290
       7      0    00   71124291      2889  71127179
root@insitedb1#

Thanks,
Ashok

0
rdashokraj
Asked:
rdashokraj
3 Solutions
 
Brian UtterbackPrinciple Software EngineerCommented:
On Solaris, in general when you are dealing with disks, the convention is that one block is 512 bytes. This is pretty much the case in the output from all commands.
0
 
arthurjbCommented:
If you are running Solaris 8 or below and the disks are mounted you can do;

df -lk

If Solaris 9 and above;

df -lh

If they are not mounted, you can mount them on temporary mount points, its more accurate than doing the conversions manually...
0
 
rdashokrajAuthor Commented:
Hi Blu,

So the disk size of d1 volume is approx 11 GB. Please correct me if am wrong. Here's my calculation:

23164002 * 512                  <-- Converting to Bytes
11859969024
11859969024/1024             <--- Converting to KB  
11582001
11582001/1024                   <---- Converting to MB
11310
11310/1024                         <--------- Converting to GB
11
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rdashokrajAuthor Commented:
Hi arthurjb,

The volume I specified (d1) is not shown in 'df' output since it is configured as swap device. I would like know exactly what is the size of swap device configured. Thats the reason, i want to convert the blocks into MB/GB.

root@insitedb1# swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d1      85,1      16 23163984 23157184
0
 
arthurjbCommented:
Well, another cheat is to run
format
select c1t0d0
then type partition
then type print

You should get a display like this;
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm   12540 - 13055        5.01GB    (516/0/0)    10501632
  1        usr    wm   12024 - 12539        5.01GB    (516/0/0)    10501632
  2     backup    wm       0 - 14086      136.71GB    (14087/0/0) 286698624
  3       swap    wu       0 -  7534       73.12GB    (7535/0/0)  153352320
  4        var    wm   11508 - 12023        5.01GB    (516/0/0)    10501632
  5       home    wm   13056 - 14086       10.01GB    (1031/0/0)   20982912
  6 unassigned    wm    7535 -  9520       19.27GB    (1986/0/0)   40419072
  7 unassigned    wm    9521 - 11507       19.28GB    (1987/0/0)   40439424

c1t0d0s1 is the second line (1) and the size is the fifth column

Since the metadisk is a mirror the size of c1t0d0s1 is the size of d1 ...
0
 
SaranyakkaliCommented:
Hi Ashok,

23164002 Block to 11.045456886 GB

Your calcuation is correct...

23164002 * 512                  <-- Converting to Bytes
11859969024
11859969024/1024             <--- Converting to KB  
11582001
11582001/1024                   <---- Converting to MB
11310
11310/1024                         <--------- Converting to GB
11

Best tool...
http://www.unitconversion.org/data-storage/gigabytes-to-blocks-conversion.html 

Please let me know if you need any more help..

Thanks
0
 
rdashokrajAuthor Commented:
Thanks a lot for your inputs
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now