How to determine physical disk size on solaris

I would like to know whether there is a simple method available for determining physical hard disk sizes on Sun sparc machines. On HP based machines it is simple:
1. run "ioscan -fnC disk" - to find all disk devices and there raw device target address ie /dev/rdsk/c0t2d2
2. run "diskinfo /dev/rdsk/c0t2d2" - display the attributes of the physical disk including size in Kbyes.
This simple process allows me create simple scripts that I can use to automate collation of audit data for a large number of HP machines.
On Sun based machines I've looked at the prtvtoc, format, and devinfo commands and have had no joy. Methods and suggestion will be well appriciated.

ok,
format should say .....eg
type format ..
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
if this is not a Sun disk, and you do not get the info,
select the required disk and select partition and then print. This will display what you need.
hope this helps

Similar Messages

  • Unable to determine Physical Disk from the VM manager : 3.2.1

    Unable to determine Physical Disk from the VM manager :
    OVM manager : 3.2.1.516
    VM Server : Available disks on vm server
    # fdisk -l
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot Start End Blocks Id System
    /dev/sda1 1 13 104391 83 Linux
    /dev/sda2 14 405 3148740 83 Linux
    /dev/sda3 406 536 1052257+ 82 Linux swap / Solaris
    Disk /dev/sdb: 80.0 GB, 80000000000 bytes
    255 heads, 63 sectors/track, 9726 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 13 104391 83 Linux
    /dev/sdb2 14 9328 74822737+ 83 Linux
    /dev/sdb3 9329 9459 1052257+ 82 Linux swap / Solaris
    Disk /dev/dm-0: 80.0 GB, 80000000000 bytes
    255 heads, 63 sectors/track, 9726 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot Start End Blocks Id System
    /dev/dm-0p1 * 1 13 104391 83 Linux
    /dev/dm-0p2 14 9328 74822737+ 83 Linux
    /dev/dm-0p3 9329 9459 1052257+ 82 Linux swap / Solaris
    Disk /dev/dm-1: 106 MB, 106896384 bytes
    255 heads, 63 sectors/track, 12 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot Start End Blocks Id System
    Disk /dev/dm-2: 76.6 GB, 76618483200 bytes
    255 heads, 63 sectors/track, 9315 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk /dev/dm-2 doesn't contain a valid partition table
    Disk /dev/dm-3: 1077 MB, 1077511680 bytes
    255 heads, 63 sectors/track, 131 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk /dev/dm-3 doesn't contain a valid partition table
    #

    thanks for your prompt response.
    I am aware of that we can't use any free spaces where the VM is installed.Hence the additional storage added to the server.
    1. Install VM Server on 80GB HD ( /dev/sdb)
    2. Later, i added 500GB to the storage ( no installation - just the disk ) ( /dev/sda)
    Same configuration worked fine in 3.0, now i am not able to identified the additional disk which was added later with 3.2.1.

  • In app store some applications are of very small size like 15-20 Mb and after installing them they become more than 100 mb. how to determine their actual size???

    in app store some applications are of very small size like 15-20 Mb and after installing them they become more than 100 mb. how to determine their actual size???

    The app store size is probably just the software, while the size on your iPhone includes data.
    You can determine the size on your iPhone by looking at Settings > General > Usage.

  • How to determine the proper size for Oracle 8i Data Base Objects

    Hi,
    I'm working on an Oracle 8i Data base. I'd like to know how to determine the proper size for the Data Base objects such as tables, datafiles, tablespaces...
    Thanks.

    Start with the docs.
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/schema.htm#949
    Best Regards
    Krystian Zieja / mob

  • Disk size in Solaris 10

    I have some confusion about disk subsystem in Solaris, i am trying to clarify from this forum.
    I have recently installed Solaris 10 in one SPARC box. After i installed, the format gives the bellow output.
    0 root wm 19491 - 29648 4.88GB (10158/0/0) 10239264
    1 swap wu 0 - 4062 1.95GB (4063/0/0) 4095504
    2 backup wm 0 - 29648 14.25GB (29649/0/0) 29886192
    From the above output, is the size of my disk is 14 GB ?, or the size of my disk is 14+2+5=21 GB ?
    I am trying to learn ZFS, so i want another partition in this disk so that i create ZFS on that partition.
    I have gone to single user mode by using CD. I assumed that, from the above "format" command output, i thought i have 21GB of disk size and 14GB of free space. So i created another partition with 14GB. Now the format command gives bellow output.
    0 root wm 19491 - 29648 4.88GB (10158/0/0) 10239264
    1 swap wu 0 - 4062 1.95GB (4063/0/0) 4095504
    2 backup wm 0 - 29648 14.25GB (29649/0/0) 29886192
    3 reserved wm 0 - 29127 14.00GB (29128/0/0) 29361024
    When i am creating ZFS, it given me a warning that the the partition i have specified is spanned into root partition (first partition), and it mentioned to use "-f" option.
    With "-f", it created successfully.
    If i assume now that the size of my disk is 14GB only then,
    (1) how come two partitions are pointing to the same area in the disk ?
    (2) How come two different filesystems are pointing to the same area ?
    Please anyone clarify my doubts. Thank you.

    Assuming a standard labeled disk it is standrad practice to have section/slice 2 being 'whole disk' for purposes of 'backup'. That would tend to indicate you have a 14GB disk. A prtvtoc /dev/dsk/c?t?d?s2 (change the ?s to the right values) will give a little more on the disk geometry.
    In the display from format column 4 is the start cylinder of the partition and column 5 is the end cylinder. From the first set out output it looks like cyclinders 4063 to 19490 are not allocated
    In the second set you have created a new slice (section 3) that overlaps both sections 0 and 1 - which is generally considered to be bad!

  • Re-read disk size in Solaris 10 x86 / VMware

    Hi
    Using
    # uname -a
    SunOS host1 5.10 Generic_142910-17 i86pc i386 i86pc
    We have a 30G virtual disk, on top of which a UFS filesystem is living, mounted, and used.
    The Virtual disk has been resized to 40G.
    I know I need to change the fdisk partition size, after which i can change the  "format" partition size, then use growfs.
    But I don't know how to get S10 to recognise the new size for the disk.
    fdisk tells me
    Total disk size is 3916 cylinders
    Cylinder size is 16065 (512 byte) blocks
    Cylinders
    Partition   Status
    Type     
    Start   End   Length
    =========   ======
    ============  =====   ===   ======   ===
    1  
    Active
    Solaris2     
    1  3915
    3915
    100
    # prtvtoc -h /dev/dsk/c1t2d0s2
           0      0    00      16065  62846280  62862344   /xxx
           2      5    01          0  62862345  62862344
           8      1    01          0     16065     16064
    # df -h /xxx
    Filesystem             size   used  avail capacity  Mounted on
    /dev/dsk/c1t2d0s0       30G    29G   498M    99%    /xxx
    On Linux I might use partprobe or blockdev --rereadpt but on Solaris?
    Cheers
    KM

    Hello
    this document should help, but make a backkup before running it
    How to expand a UFS Lun in Solaris 10 (Doc ID 1451858.1)
    Regards
    Eze

  • How to determine the database size corresponding to the nber records in DSO

    Hi Colleagues,
    I would like to determine the database size corresponding to my new BI project.
    I know the number of records uploaded in the DSO from the source system for the intialization phase.
    How can I deduct the database size / disk size corresponding to the number of record uploaded ?
    Thanks,

    Hi Ram,
    I am with SAP BI Release SAPKW70019
    I do not have the option Single Table analysis -
    I have in DB02 or ST04 the following options.
    *- Space*
    -- space overview
    ->database
    --overview
    ->users
    --overview
    --detailed analysis
    -> tablespaces
    --overview
    --detailed analysis
    -> segments
    --overview
    --Detailed analysis
    --Detailed Analysis Aggregated
    -> Additional Functions
    --Collector Logs
    --BW Analysis
    Where should I go through ?
    Thanks

  • How to determine the field size

    I am going to make a multiplatform application that hopefully
    will run on linux and windows 2000.If the os is 2000, then I will use
    vb.net/aspx else I'll use java servlets. I make the connection
    to the web server ( through HTTP) not directly to database server.
    So, the resultset will be stored in the String object. The columns
    will be separated by delimeter. Our problem is how to determine
    the size and type of the fields of mssql,oracle and postgres database
    so that we can include it in the String object.
    Ex.
    String sResultSet=new String();
    ResultSet rs=statement.executeQuery(sSQL);
    while(rs.next()){
    sResultset=sResultSet + rs.getString(field1) + "||" + rs.getString(field2) + "||";
    vertical bars acts as delimeter
    supposedly this is the code:
    sResultset=sResultSet + rs.getString(field1) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||" + rs.getString(field2) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||";
    supposedly this is the code if rs.getFieldType() and rs.getFieldSize() methods are existing
    Anyone can give me an idea how to get the field type and field size of the database?
    thanks in advance

    Yes, but I dont know how to do it.
    Can you give me an example of using it.
    Thanks in advance

  • How to get the disk size

    Hi, everyone, does anyone know how to get the size of the disk, say hard disk? In the Writing Device Driver it says that the block device driver must create an 'nblocks' property for each minor block device. I want to get the size of the block device in another driver. Is there any DDI/DKI kernel function for this?
    How to get the same thing in a user mode application? Is there any API to do this?
    Thank you very much.

    I just found a function in include/sys/conf.h. The prototype is:
    extern int bdev_size(dev_t);
    Can I use this function to get the disk size of the device dev_t? I couldn't find the documentation of this function.
    Thanks

  • How to determine the file system on Solaris

    Friends,
    How to determine which file system I have installed UFS or ZFS on Solaris
    Thanks

    Other methods would include looking at the /etc/vfstab if it's in there or fstyp(1M):
    System Administration Commands fstyp(1M)
    NAME
    fstyp - determine file system type
    SYNOPSIS
    fstyp [-a | -v] special [:logical-drive]

  • How get os physical block size ?

    man dd, it advice bs parameter be a multiple of the physical block size .
    How can I get physical block size ? such as aix, hpux ,suselinux.
    bs=BlockSize
    Specifies both the input and output block size, superseding the ibs and obs flags. The block size values
    specified with the bs flag must always be a multiple of the physical block size for the media being used.

    Learning new things today, thanks guys!
    $ printf "a" >1bytefile.txt && echo $(( 512 * $(du 1bytefile.txt | cut -f1) )) && rm 1bytefile.txt
    1024
    $ sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jul 24 16:15:04 2012
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SYS@TTST> select
      2    max(l.lebsz)  log_block_size
      3  from
      4    sys.x$kccle  l
      5  where
      6    l.inst_id = userenv('Instance');
    LOG_BLOCK_SIZE
              1024
    SYS@TTST> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    $  /usr/sbin/fstyp -v /dev/vg01/lvol04
    /dev/vg01/lvol04: Permission denied
    $ su
    Password:
    # /usr/sbin/fstyp -v /dev/vg01/lvol04
    vxfs
    version: 5
    f_bsize: 8192
    f_frsize: 1024
    f_blocks: 786432000
    f_bfree: 87190098
    f_bavail: 81740717
    f_files: 22035604
    f_ffree: 21797524
    f_favail: 21797524
    f_fsid: 1073807364
    f_basetype: vxfs
    f_namemax: 254
    f_magic: a501fcf5
    f_featurebits: 0
    f_flag: 16
    f_fsindex: 10
    f_size: 786432000
    # uname -r
    B.11.23
    # uname
    HP-UXMore info over in the hp communities.

  • Tablespace allocation type system  how oracle determines the extent size

    HI
    It may be silly question but the I have to ask and get some knowdge
    Suppose tablespace allocation_type is system then how oracle determins the inital extent and max extent size?

    Was this tablespace converted to locally managed from an existing tablespace? If so, the existing extents still exist after the conversion. Also depending on the Oracle version and maybe platform the pct_increase parameter is still honored after the conversion which can lead to odd sizes. The current value of this parameter may not be the value that was in effect when extents were allocated.
    Also Oracle enhanced the logic to not leave odd sized extents unused so that if by rights the system should take a 64K extent but there is a 56K extent available (perhaps at the end of a file) it can be used to fill the extent request.
    HTH -- Mark D Powell --

  • How to increase disk size in solaris

    Hi all
    I have two disk c1t0d0s0 / c1t0d0s7
    I do haven't space in disk /dev/dsk/c1t0d0s0
    run df -h
    /dev/dsk/*c1t0d0s0* 8,8G 7,4G 1,3G 86% /
    /devices 0K 0K 0K 0% /devices
    ctfs 0K 0K 0K 0% /system/contract
    proc 0K 0K 0K 0% /proc
    mnttab 0K 0K 0K 0% /etc/mnttab
    swap 3,4G 984K 3,4G 1% /etc/svc/volatile
    objfs 0K 0K 0K 0% /system/object
    sharefs 0K 0K 0K 0% /etc/dfs/sharetab
    /usr/lib/libc/libc_hwcap1.so.1
    8,8G 7,4G 1,3G 86% /lib/libc.so.1
    fd 0K 0K 0K 0% /dev/fd
    swap 3,4G 72K 3,4G 1% /tmp
    swap 3,4G 40K 3,4G 1% /var/run
    /dev/dsk/*c1t0d0s7* 20G 21M 20G 1% /export/home
    I want increasing the space in c1t0d0s0. when I installed Solaris 10 I do not looked attentively the size allocated
    Thanks

    Hi,
    As I understand, you want to increase the size of the root partition (where you installed Solaris) which resides in c1t0d0s0. I think it can be done using Concatenations from Solaris Volume Manager (SVM).
    I have tried it in non root partition like /export/home and it is very easy.
    metainit -f d0 2 1 c1t0d0s7 1 c2t0d0s7 //this will create volume d0 as a concatenation
    growfs -M /export/home /dev/md/rdsk/d0 //this will grow the /export/home partition
    Regards,
    Rei

  • Failed Mirrored RAID - How to determine which disk?

    Hello Apple Support,
    I've run into a bit of trouble with my RAID and I was hoping I might find some help with it.  Here's the deal:
    I have two 1.5 TB Seagate Barracuda drives in an OWC Mercury Elite AL-Pro enclosure.  I recently noticed that one of the disks has failed, so I need to yank it outta there and send in on back to Amazon to get a replacement.  However this has proved a bit tricky, for a number of reasons.
    1.  I initially noticed that one of the drives had failed because the available disk space was grossely outta wack, Finder reported that there were 921 GBs of free space, when there should only have been about 300 GBs.  Along with this, many of the files I'd recently downloaded were missing, although older files were available.  I thought this was strange because the RAID is mirrored, which (I thought) meant that both drives contained the same data, so that if one failed the other drive would still have the current data. 
    2.  I opened up the OWC enclosure and disconnected one of the drives and then booted up the RAID to see if I'd be able to determine by "guess and check" which drive had failed.  Now, however, I get this picture from Disk Utility:
    When I now navigate to the RAID volume in Finder, it shows me the 900 GB of freespace.  Does this mean that the drive I did not disconnect is the failed drive?
    Beyond this, how do I go about restoring the RAID when I receive the new drive back in the mail?

    If you start with 5 x 2TB disks in raid 3 or 5, you will have a net space of (5 - 1) x 2TB = 8TB.
    When you later add a 6-th or 7-th disk, by expanding the array, you will increase storage by 2 TB for each added disk.
    At the same time you will increase the transfer speed of the array.
    Expanding an array is not difficult, just time consuming, especially for a raid5, because all the data need to be rewritten to all the disks, but also the parity needs to be recalculated and written to all member disks because of the distributed parity in raid5. Raid3 has the advantage of writing parity only to a single dedicated disk.
    I suggest you only use identical disks in the array. If you now buy 5 identical ones and at a later date decide to add more disks, make sure the new disks are identical to the ones you now use.

  • How to determine the Memory size of my computer?

    I need to find a way to determine how much computer RAM i have left. I was suggested to use System class methods like "Runtime.getRuntime().getFreeMemory()", and I need to determine how much Memory I need to use when I launch Java VM with Xmx option.
    I wonder if there is more detail I need to know at this moment? If this question is more suitable in Java VM forum, please let me know.

    This is a slightly messed version of the one in the J2D Demo, use JFrame.add(new MemoryMonitor());
    I'm not entirely sure if it'll work straight off since I messed with it but it should, all the memory stuff is hidden away there somewhere even if it won't.
    Shish
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.Line2D;
    import java.awt.geom.Rectangle2D;
    import java.util.Date;
    import javax.swing.*;
    import javax.swing.border.EtchedBorder;
    import javax.swing.border.TitledBorder;
    public class MemoryMonitor extends JPanel {
        static JCheckBox dateStampCB = new JCheckBox("Output Date Stamp");
        public Surface surf;
        JPanel controls;
        boolean doControls;
        JTextField tf;
        public MemoryMonitor() {
         note=n;
            setLayout(new BorderLayout());
            setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
            add(surf = new Surface());
            controls = new JPanel();
            controls.setPreferredSize(new Dimension(135,80));
            Font font = new Font("serif", Font.PLAIN, 10);
            JLabel label = new JLabel("Sample Rate");
            label.setFont(font);
            label.setForeground(Color.black);
            controls.add(label);
            tf = new JTextField("1000");
            tf.setPreferredSize(new Dimension(45,20));
            controls.add(tf);
            controls.add(label = new JLabel("ms"));
            label.setFont(font);
            label.setForeground(Color.black);
            controls.add(dateStampCB);
            dateStampCB.setFont(font);
            addMouseListener(new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                   removeAll();
                   if ((doControls = !doControls)) {
                       surf.stop();
                       add(controls);
                   } else {
                       try {
                           surf.sleepAmount = Long.parseLong(tf.getText().trim());
                       } catch (Exception ex) {note.alert(ex);}
                       surf.start();
                       add(surf);
                   validate();
                   repaint();
        public void start() {
         surf.start();
        public class Surface extends JPanel implements Runnable {
            public Thread thread;
            public long sleepAmount = 1000;
            private int w, h;
            private BufferedImage bimg;
            private Graphics2D big;
            private Font font = new Font("Times New Roman", Font.PLAIN, 11);
            private Runtime r = Runtime.getRuntime();
            private int columnInc;
            private int pts[];
            private int ptNum;
            private int ascent, descent;
            private float freeMemory, totalMemory;
            private Rectangle graphOutlineRect = new Rectangle();
            private Rectangle2D mfRect = new Rectangle2D.Float();
            private Rectangle2D muRect = new Rectangle2D.Float();
            private Line2D graphLine = new Line2D.Float();
            private Color graphColor = new Color(46, 139, 87);
            private Color mfColor = new Color(0, 100, 0);
            private String usedStr;
            public Surface() {
                setBackground(Color.black);
                addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent e) {
                        if (thread == null) start(); else stop();
            public Dimension getMinimumSize() {
                return getPreferredSize();
            public Dimension getMaximumSize() {
                return getPreferredSize();
            public Dimension getPreferredSize() {
                return new Dimension(135,80);
            public void paint(Graphics g) {
                if (big == null) {
                    return;
                big.setBackground(getBackground());
                big.clearRect(0,0,w,h);
                float freeMemory = (float) r.freeMemory();
                float totalMemory = (float) r.totalMemory();
                // .. Draw allocated and used strings ..
                big.setColor(Color.green);
                big.drawString(String.valueOf((int) totalMemory/1024) + "K allocated",  4.0f, (float) ascent+0.5f);
                usedStr = String.valueOf(((int) (totalMemory - freeMemory))/1024)
                    + "K used";
                big.drawString(usedStr, 4, h-descent);
                // Calculate remaining size
                float ssH = ascent + descent;
                float remainingHeight = (float) (h - (ssH*2) - 0.5f);
                float blockHeight = remainingHeight/10;
                float blockWidth = 20.0f;
                float remainingWidth = (float) (w - blockWidth - 10);
                // .. Memory Free ..
                big.setColor(mfColor);
                int MemUsage = (int) ((freeMemory / totalMemory) * 10);
                int i = 0;
                for ( ; i < MemUsage ; i++) {
                    mfRect.setRect(5,(float) ssH+i*blockHeight,
                                    blockWidth,(float) blockHeight-1);
                    big.fill(mfRect);
                // .. Memory Used ..
                big.setColor(Color.green);
                for ( ; i < 10; i++)  {
                    muRect.setRect(5,(float) ssH+i*blockHeight,
                                    blockWidth,(float) blockHeight-1);
                    big.fill(muRect);
                // .. Draw History Graph ..
                big.setColor(graphColor);
                int graphX = 30;
                int graphY = (int) ssH;
                int graphW = w - graphX - 5;
                int graphH = (int) remainingHeight;
                graphOutlineRect.setRect(graphX, graphY, graphW, graphH);
                big.draw(graphOutlineRect);
                int graphRow = graphH/10;
                // .. Draw row ..
                for (int j = graphY; j <= graphH+graphY; j += graphRow) {
                    graphLine.setLine(graphX,j,graphX+graphW,j);
                    big.draw(graphLine);
                // .. Draw animated column movement ..
                int graphColumn = graphW/15;
                if (columnInc == 0) {
                    columnInc = graphColumn;
                for (int j = graphX+columnInc; j < graphW+graphX; j+=graphColumn) {
                    graphLine.setLine(j,graphY,j,graphY+graphH);
                    big.draw(graphLine);
                --columnInc;
                if (pts == null) {
                    pts = new int[graphW];
                    ptNum = 0;
                } else if (pts.length != graphW) {
                    int tmp[] = null;
                    if (ptNum < graphW) {    
                        tmp = new int[ptNum];
                        System.arraycopy(pts, 0, tmp, 0, tmp.length);
                    } else {       
                        tmp = new int[graphW];
                        System.arraycopy(pts, pts.length-tmp.length, tmp, 0, tmp.length);
                        ptNum = tmp.length - 2;
                    pts = new int[graphW];
                    System.arraycopy(tmp, 0, pts, 0, tmp.length);
                } else {
                    big.setColor(Color.yellow);
                    pts[ptNum] = (int)(graphY+graphH*(freeMemory/totalMemory));
                    for (int j=graphX+graphW-ptNum, k=0;k < ptNum; k++, j++) {
                        if (k != 0) {
                            if (pts[k] != pts[k-1]) {
                                big.drawLine(j-1, pts[k-1], j, pts[k]);
                            } else {
                                big.fillRect(j, pts[k], 1, 1);
                    if (ptNum+2 == pts.length) {
                        // throw out oldest point
                        for (int j = 1;j < ptNum; j++) {
                            pts[j-1] = pts[j];
                        --ptNum;
                    } else {
                        ptNum++;
                g.drawImage(bimg, 0, 0, this);
            public void start() {
                thread = new Thread(this);
                thread.setPriority(Thread.MIN_PRIORITY);
                thread.setName("MemoryMonitor");
                thread.start();
            public synchronized void stop() {
                thread = null;
                notify();
            public void run() {
                Thread me = Thread.currentThread();
                while (thread == me && !isShowing() || getSize().width == 0) {
                    try {
                        thread.sleep(500);
                    } catch (InterruptedException e) { return; }
                while (thread == me && isShowing()) {
                    Dimension d = getSize();
                    if (d.width != w || d.height != h) {
                        w = d.width;
                        h = d.height;
                        bimg = (BufferedImage) createImage(w, h);
                        big = bimg.createGraphics();
                        big.setFont(font);
                        FontMetrics fm = big.getFontMetrics(font);
                        ascent = (int) fm.getAscent();
                        descent = (int) fm.getDescent();
                    repaint();
                    try {
                        thread.sleep(sleepAmount);
                    } catch (InterruptedException e) { break; }
                    if (MemoryMonitor.dateStampCB.isSelected()) {
                         System.out.println(new Date().toString() + " " + usedStr);
                thread = null;
    public static void main(String s[]) {
            final MemoryMonitor demo = new MemoryMonitor();
            WindowListener l = new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
                public void windowDeiconified(WindowEvent e) { demo.surf.start(); }
                public void windowIconified(WindowEvent e) { demo.surf.stop(); }
            JFrame f = new JFrame("Java2D Demo - MemoryMonitor");
            f.addWindowListener(l);
            f.getContentPane().add("Center", demo);
            f.pack();
            f.setSize(new Dimension(200,200));
            f.setVisible(true);
            demo.surf.start();

Maybe you are looking for