Solved

Converting Blocks to Size (in Solaris)

Posted on 2008-10-28
7
2,656 Views
Last Modified: 2013-12-27
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
Comment
Question by:rdashokraj
7 Comments
 
LVL 22

Assisted Solution

by:blu
blu earned 75 total points
ID: 22827878
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
 
LVL 14

Expert Comment

by:arthurjb
ID: 22828229
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
 

Author Comment

by:rdashokraj
ID: 22828382
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:rdashokraj
ID: 22828394
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
 
LVL 14

Assisted Solution

by:arthurjb
arthurjb earned 75 total points
ID: 22828476
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
 
LVL 3

Accepted Solution

by:
Saranyakkali earned 100 total points
ID: 22829392
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
 

Author Closing Comment

by:rdashokraj
ID: 31511003
Thanks a lot for your inputs
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now