Solved

Converting Blocks to Size (in Solaris)

Posted on 2008-10-28
7
2,792 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
awk file 6 96
centos commands 6 88
Equivalent of WSUS for Solaris, AIX and Cisco devices 11 64
Linux kernel panic ext3-fs error 14 23
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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 …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

735 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