Determine free space in a Disk device

Version: Solaris 10 (August 2011) on VM

I am kind of new to Solaris.From VM workstation i allocated 35 GB to this Solaris VM's Disk

The disk was named

c1t0d0

Few basic slices for root(8gb), swap(517mb) and /export/home(494mb) were created by the solaris Installer during the installation.

/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c1t0d0s7 is currently mounted on /export/home. Please see umount(1M).

Now there is around 25 gb left unallocated in the underlying disk. Using format command, I wanted to create a new slice with 20gb, but i was getting

`20.00gb' is out of range

error. I tried 10g but it didn't work. 1GB worked though.

Is there any way i could determine how much space is left in the Disk after these slice creations ? I see lot of options in format command , but i couldn't find a command to determine how much space remain unallocated in a Disk device c1t0d0 .

Here is what i tried to do to create a new slice of 20 gb. In case you find anything wrong , please let me know

# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <DEFAULT cyl 1273 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@0,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c1t0d0s7 is currently mounted on /export/home. Please see umount(1M).


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 1273 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm     130 - 1272        8.76GB    (1143/0/0) 18362295
  1       swap    wu       1 -   66      517.72MB    (66/0/0)    1060290
  2     backup    wm       0 - 1272        9.75GB    (1273/0/0) 20450745
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7       home    wm      67 -  129      494.19MB    (63/0/0)    1012095
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0

partition> 3
Part      Tag    Flag     Cylinders        Size            Blocks
  3 unassigned    wm       0               0         (0/0/0)           0

Enter partition id tag[unassigned]: reserved
Enter partition permission flags[wm]:
Enter new starting cyl[1]: 130
Enter partition size[0b, 0c, 130e, 0.00mb, 0.00gb]: 20.00gb
`20.00gb' is out of range
Enter partition size[0b, 0c, 130e, 0.00mb, 0.00gb]: 10.00gb
`10.00gb' is out of range
Enter partition size[0b, 0c, 130e, 0.00mb, 0.00gb]: 1.00gb

Nothing left all partitions are assigned you need to reparation your disk

1 Like

But I had allocated 35gb to this VM.
Going back to my original question : How to determine how much space is left in the Disk from format or any other command? Is it from the partition table that u realized that there is no space left ?
Thank you Foorza.

The disk you have is not 35GB, but 9.75GB (at least it was initially labeled as such).

How did I know ? Well I assumed that you have performed a default install for Solaris.
To get information about the disk

$iostat -En

If the disk is a supported disk, it usually says it's size in the "Product" field.

Thank you Bartus11,Foorsa

From my underlying disk c1t0d0

I need to create the following filesystems.

9GB for /
2GB for swap
1.5GB for /tmp
1GB for /export/home
20GB for /u02

Can this be done during the installation itself? If so, In the following link , at "Screen 29"

ORACLE - DBA Tips Corner

What should i choose ?

Should i allocate the entire disk space to 'Solaris' partion On "Customize fdisk partitions' screen at first ?

you should simply enter every slice and its size. they have provided example for / and swap.

order of slices might be important. because (spinning) disk is faster at beginning. (but not much if its inside virtual machine)

Yes during instillation that would be easier just follow the disk layout screen during installation I have attached some screen shot that illustrates the steps ,Otherwise if your Solaris storage management skills is good you can grow your UFS file system on a fully installed OS but you need to repartition your disk layout

Thank you foorsa.Thanks everyone.

I think i found the cause of the "issue" with the help from you guys.

On the screen 'Customize fdisk partitions' (the 3rd screenshot above)
i allocated only 10,000mb to 'Solaris' partition thinking that the rest of 25 gb can be used later to create a new slice.

I shouldn't have done this . Right?

Right. Solaris fdisk partition is treated by Solaris as whole disk, so if you want to have 35GB disk in Solaris (that you can later divide into slices), then you need to create 35 Solaris fdisk partition.

1 Like

it is possible to change size of last slice after re-labeling the drive.
ufs filesystem can 'grow', but to shrink it you'd need to backup+restore.

1 Like

yes ferrozo said the right thing.......you have only 9.75 gb complete space in solaris ...u have to re partition ur disk again

@polavan: can you tell what is the full size of your hard disk and not just its Solaris partition which is 9.75 GB ?

This can be shown with

iostat -En | sed -n '/c1t0d0/,$p' | head -5

Show us also its current fdisk partitioning:

echo 6 | fdisk /dev/rdsk/c1t0d0p0 | sed -n '/Total/,/SELECT/p'

Here you go

# iostat -En | sed -n '/c1t0d0/,$p' | head -5
c1t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: VMware,  Product: VMware Virtual S Revision: 1.0  Serial No:
Size: 37.58GB <37580963328 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 4 Predictive Failure Analysis: 0
#
#
#
# echo 6 | fdisk /dev/rdsk/c1t0d0p0 | sed -n '/Total/,/SELECT/p'
             Total disk size is 4568 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1  1275    1275     28

Here is the output of df (if it is useful)

# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0      8.6G   4.2G   4.4G    49%    /
/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                   1.7G  1004K   1.7G     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.6G   4.2G   4.4G    49%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.7G   144K   1.7G     1%    /tmp
swap                   1.7G    36K   1.7G     1%    /var/run
/dev/dsk/c1t0d0s7      464M   1.0M   417M     1%    /export/home

The simpler would be for you to create a second primary partition using the remaining unallocated 25 GiB then create a ZFS pool on it.

For the first task, use fdisk in interactive mode:

# fdisk /dev/rdsk/c1t0d0p0
Enter Selection: 1  (Create a partition)
Indicate the type of partition you want to create: 4 (Other) or 8 (FAT32) but not 1 (SOLARIS2)
Specify the percentage of disk to use for this partition: 72 (as you have already 28% used)
Should this to become the Active partition? : n
Enter Selection: 5  (update disk configuration and exit)

Then, to create the ZFS pool, simply run this command:

zpool create u02 c1t0d0p2

and you are done.

1 Like

As always jlliagre rocks.

Thank you jlliagre . I wanted to create a UFS filesystem.

@polavan if so have a look here.

What UFS provides ZFS doesn't ?