Solaris 10, Adding drives in VMware

If you have a Solaris VMware image which needs additional space, these steps can be performed to add another disk to the image and configure it. (These steps were applicable to previous versions of Solaris, but this post was just updated after installing Solaris 10, 8/07). If you are new to Solaris or want a great alternative to Linux, explore the Solaris Express Developer Edition Community.

The following steps can be performed to add another disk to a Solaris 10 VMware image. Most steps are general Solaris admin tasks, so the configuration is straight forward.

Add a VMware Disk to a Solaris image

  • Shut down the VM
  • Edit the VMware configuration: Select Virtual Machines -> Settings
  • Add a new hard disk device
  • start the Solaris image

Tell Solaris to look for new devices when booting

  • Select the Solaris entry GRUB menu that you want to boot.
  • to edit, enter e
  • select the "kernel /platform" line
  • to edit that again enter e
  • add to the end of the 'kernel' line a space followed by -r
    kernel /platform/i86pc/multiboot -r
  • press enter key to accept the change
  • press b to boot
OPTIONAL: Another method to force Solaris to rebuild the device tree: You can force Solaris to rebuild it's device tree while the system is running but creating an empty file and rebooting Solaris:
#touch /reconfigure
#reboot

Use format to Partition the new disk

#format
Example output:
AVAILABLE DISK SELECTIONS:
       0. c0d0 
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Select the new device (1 for c0d1 in my case): Specify disk (enter its number): 1 Select fdisk to create a partition table format> fdisk Select 'y' for 100% solaris View the partition table - select 'p' for partition table format> p Then 'p' to print the partition table format> p Note the size of the device (partition 2, 1 GB in my case)
Current partition table (original):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1020     1021.00MB    (1021/0/0) 2091008
  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 unassigned    wm       0               0         (0/0/0)          0
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 alternates    wm       1 -    2        2.00MB    (2/0/0)       4096

partition>
Allocate space to slice s0 partition> 0 - Select the details for slice 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 3
Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: 1017c
Note: The size 1017c (cylinders) was selected above since slice 8 and 9 are using the first 3 cylinders, the remaining cylinders on the disk is obtained be subtracting the used cylinders (3) from the total cylinders (1020 listed in slice 2, the backup slice which listed the entire size of the disk)
Select 'p' to print the partition table and verify the correct size
partition> p
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       3 - 1019     1017.00MB    (1017/0/0) 2082816
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1020     1021.00MB    (1021/0/0) 2091008
  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 unassigned    wm       0               0         (0/0/0)          0
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 alternates    wm       1 -    2        2.00MB    (2/0/0)       4096

Select label to write the partition table to disk, quit format
partition> label
Ready to label disk, continue? y
partition> q
format> q

Create a new file system on the new disk slice

First a quick note about options. You can create a ufs filesystem, or the fantastic zfs file system. I will show the steps for each, I have been told by some of my Sun collegues that: if you are creating a partition for Solaris Live Upgrade to use, it must be a bootable partition and as of 9/07 you can not boot from a ZFS partition so you must create a UFS one. If the objective is to create a Live Upgrade partition, you are done (you don't put a files system on it, lucreate will handle that).

OPTION 1: create a ufs filesystem

bash-3.00# newfs /dev/dsk/c0d1s0
newfs: construct a new file system /dev/rdsk/c0d1s0: (y/n)? y
/dev/rdsk/c0d1s0:       2082816 sectors in 1017 cylinders of 64 tracks, 32 sectors
1017.0MB in 64 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)

Mount the new filesystem
bash-3.00# mount /dev/dsk/c0d1s0 /disk2
bash-3.00# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0d0s0      9239837 3366138 5781301    37%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 2109532     852 2108680     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/usr/lib/libc/libc_hwcap1.so.1
                     9239837 3366138 5781301    37%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
swap                 2108728      48 2108680     1%    /tmp
swap                 2108708      28 2108680     1%    /var/run
/hgfs                16777215    4096 16772864     1%    /hgfs
/tmp/VMwareDnD       67108860   16384 67091456     1%    /var/run/vmblock
/dev/dsk/c0d1s0       978927    1041  919151     1%    /disk2

OPTIONAL: edit the vfstab file to add the mount point
/dev/dsk/c0d1s0 /dev/rdsk/c0d1s0        /disk2 ufs     1       yes     -

mount the new file system
#mount /disk2 
or 
#mountall

OPTION 2: create a zfs filesystem

The zfs filesystem is quite impressive. It is also quite simple to setup. create the zfs pool:
# zpool create -f zones c1d1s0
The filesystem is now created and mounted:
bash-3.00# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0d0s0      9239837 3366140 5781299    37%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 2104416     852 2103564     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/usr/lib/libc/libc_hwcap1.so.1
                     9239837 3366140 5781299    37%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
swap                 2103612      48 2103564     1%    /tmp
swap                 2103592      28 2103564     1%    /var/run
/hgfs                16777215    4096 16772864     1%    /hgfs
/tmp/VMwareDnD       67108860   16384 67091456     1%    /var/run/vmblock
/dev/dsk/c0d1s0       978927    1041  919151     1%    /disk2
disk3                 999424      24  999339     1%    /disk3


Many other interesting things can be done with zfs, but that is a topic of another post, here are a few commands for snapshots to play with:
# zfs snapshot disk3@empty
# zfs list -t snapshot
NAME          USED  AVAIL  REFER  MOUNTPOINT
disk3@empty      0      -  24.5K  -
Now we can rollback to the empty snapshot at any time in the future with:
# zfs rollback -r disk3@empty


Tags:

Comments:

Dear Derrick:

Thank you for publishing a thorough, useful, and easy to follow guide. We recently had a large number of Solaris VM's to configure and your guide was a primary reference.

Best regards,

Corbin H. Links, President
Links Business Group LLC

Posted by Corbin Links on November 05, 2007 at 09:54 AM CST #

I have downloaded the Solaris Express Developer Edition 9/07 in VMware image at:
http://developers.sun.com/sxde/download.jsp

, but doesn't describe the root password for login!.

I searched in the Sun site, documentation, faq, etc....nothing.

I trying root, "vmware" unsuccessfully...
Anybody know the password?

Thanks!

Posted by MrSparc on November 07, 2007 at 08:46 AM CST #

Hello MrSparc:

Per the readme.html on the download site:
- Adminstrator account - root
- Root password: sxde
- User accounts : <no user accounts set up>

Best regards,
-Corbin

Posted by Corbin Links on November 11, 2007 at 03:34 PM CST #

Hi,

Q1: Can I install VMware tools onto this SXDE?

Q2: Why there is NO /usr/local/bin directory?

Posted by Thomas on February 09, 2008 at 06:42 AM CST #

Hi,

Q1: Can I install VMware tools onto this SXDE?

Q2: Why there is NO /usr/local/bin directory?

Posted by Thomas on February 09, 2008 at 06:52 AM CST #

i went through it.it is very helpfull to me

Posted by shantireddy on April 08, 2008 at 01:17 PM CDT #

Hi Derrick,

I have added a new hard disk in the VM. I tried the format option. It gave the some errors like:

bash-3.00# newfs /dev/dsk/c0d1p0
newfs: construct a new file system /dev/rdsk/c0d1p0: (y/n)? y
mkfs: bad value for size: 0 must be between 1024 and 0
mkfs: size reset to default 0
seek error on sector -1: Error 0

But formatting zpool is quite easy.

Can i use the zfs file system as any normal file system or daily use.

Thanks and Regards,
Vivek

Posted by vivek on December 30, 2008 at 01:48 AM CST #

Yes,

As long as you are using a version of Solaris 10 (or OpenSolaris) that supports it, you can use zfs and I recommend it. The current version of OpenSolaris also supports zfs for the root partition.

Posted by Derrick on January 05, 2009 at 02:11 PM CST #

Edit the VMware configuration: Select Virtual Machines -> Settings
Add a new hard disk device .
I add new hard disk like i mention here but in sun 10 when i am using format command i am unable to see that disk. (i am seeing only one disk there not new ones)
plz help me to add n use the disk or partition as disk.
i am using vmware workstation 6.0.0

Thank You

Posted by Anand on January 07, 2009 at 04:48 AM CST #

Did you do one of the 2 options in: Tell Solaris to look for new devices when booting, above? If not Solaris will not rebuild it's device tree and will not see the new drive. Try this method (as root in the Solaris 10 image):

OPTIONAL: Another method to force Solaris to rebuild the device tree: You can force Solaris to rebuild it's device tree while the system is running by creating an empty file and rebooting Solaris:

#touch /reconfigure
#reboot

Posted by Derrick Harcey on January 07, 2009 at 08:21 AM CST #

Thanx Derrick,
Is their any key combination on windows keyboard which i use as STOP + A for sun solaris.

Posted by Anand on January 14, 2009 at 11:03 PM CST #

sasas

Posted by sasa on May 12, 2009 at 03:34 PM CDT #

Excellent Work Derrick !! This is the best info i got on the web for adding drives in Sol 10 :))

Good work

Regards,
Lucky

Posted by Lucky on June 26, 2009 at 02:09 AM CDT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by harcey