Solved

Converting Blocks to Size (in Solaris)

Posted on 2008-10-28
7
2,772 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
android secure ftp 3 52
number in printf 13 32
CLI command keep running after close 7 36
When trying to install php-fpm on CentOS 7 - GPG error 2 45
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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