Adding a Hard Drive to Solaris 10

Here’s how you would add a hard drive to Solaris 10, including the format, fdisk, partition, and then creation of the file system. Of course, you first need to actually add the hard drive physically to the machine, I’m not going to cover that – if you don’t know how to do that then the rest of the information isn’t going to help!

If you installed a drive through VMWare while the VM is running, you will need Solaris to recognize the new drive. In this case, run devfsadm, otherwise boot your system and Solaris should recognize the new drive.

First, here’s the original drives (c0t0d0 & c1t0d0):

# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0

Have Solaris check for new hardware:

# devfsadm

Now you can see there is a new disk on another bus (c1t1d0):

# ls /dev/rdsk/*s0
/dev/rdsk/c0t0d0s0 /dev/rdsk/c1t0d0s0 /dev/rdsk/c1t1d0s0

Next, we want to format the drive (which includes creating the partitions):

# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci1000,30@10/sd@0,0
1. c1t1d0
/pci@0,0/pci1000,30@10/sd@1,0
Specify disk (enter its number):

Type “1”, the option for the new drive and hit “enter”. Depending on the type of disk it may be preformatted:

selecting c1t1d0
[disk formatted]

If your drive is not formatted, type format at the format prompt to low level format your hard drive. Next, we need to use fdisk to create the partitions, type “y” to create the default Solaris partition:

format> fdisk
No fdisk table exists. The default partition for the disk is:

a 100% “SOLARIS System” partition

Type “y” to accept the default partition, otherwise type “n” to edit the
partition table.
y

Next enter the partition menu, by typing partition:

format> partition

You can print out the current partitioning first if you like:

partition> print
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 1.99GB (1021/0/0) 4182016
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 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0

In this case, I just want to create one large partition for some extra storage so I will allocate all I can to partition 0. Note that partition 2 is used to reference the entire drive and is not a usable partition. To modify a given partition, just enter the number of the partition at the partition prompt:

partition> 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]: 1
Enter partition size[0b, 0c, 1e, 0.00mb, 0.00gb]: 1019c

And now to print the partition table again you can see what has changed:

partition> print
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 unassigned wm 1 – 1019 1.99GB (1019/0/0) 4173824
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 – 1020 1.99GB (1021/0/0) 4182016
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 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0

Save your changes by writing the label to the disk:

partition> label
Ready to label disk, continue? y

Quit out of the partition prompt, and then the format prompt, which takes you back to the command prompt:

partition> quit
format> quit
#

Now we are ready to create a file system on this new partition (in this case UFS).

# newfs /dev/rdsk/c1t1d0s0
newfs: construct a new file system /dev/rdsk/c1t1d0s0: (y/n)? y
/dev/rdsk/c1t1d0s0: 4173824 sectors in 1019 cylinders of 128 tracks, 32 sectors
2038.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112,
4052352, 4146592

Make sure that the file system is clean:

# fsck /dev/rdsk/c1t1d0s0
** /dev/rdsk/c1t1d0s0
** Last Mounted on
** Phase 1 – Check Blocks and Sizes
** Phase 2 – Check Pathnames
** Phase 3a – Check Connectivity
** Phase 3b – Verify Shadows/ACLs
** Phase 4 – Check Reference Counts
** Phase 5 – Check Cylinder Groups
2 files, 9 used, 2020758 free (14 frags, 252593 blocks, 0.0% fragmentation)

Next, add the proper line to /etc/vfstab:

/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 /data ufs 2 yes –

And then mount the partition. In this case, I’m making a /data partition:

# mkdir /data
# mount /data
# df -h /data
Filesystem size used avail capacity Mounted on
/dev/dsk/c1t1d0s0 1.9G 2.0M 1.9G 1% /data

You’re all done!





Please VOTE for this page at: ADD TO DEL.ICIO.US | ADD TO DIGG | ADD TO FURL | ADD TO NEWSVINE | ADD TO NETSCAPE | ADD TO REDDIT | ADD TO STUMBLEUPON | ADD TO TECHNORATI FAVORITES | ADD TO SQUIDOO | ADD TO WINDOWS LIVE | ADD TO YAHOO MYWEB | ADD TO ASK | ADD TO GOOGLE


51 Comments


  1. Totally Awesome. Worked perfectly!

    Thank You
    Thank You
    Thank You!

    Posted March 3, 2008, 10:17 pm

  2. Also note that the newfs and fsck commands use ‘rdsk’ paths and the mount command uses ‘dsk’ paths.

    Using ‘rdsk’ in a mount command will give you the ‘mount: /dev/rdsk/c0t1d0s0 not a block device’ error.

    # mount /dev/rdsk/c0t1d0s0 /mnt/a
    mount: /dev/rdsk/c0t1d0s0 not a block device

    # mount -F ufs /dev/dsk/c0t1d0s0 /mnt/a
    # cd /mnt/a
    # df -h .
    Filesystem size used avail capacity Mounted on
    /dev/dsk/c0t1d0s0 67G 64M 67G 1% /mnt/a
    #

    Good stuff though.

    Cheers,

    Moh.

    Posted April 18, 2008, 11:31 am

  3. I agree with everything you are saying, I’m just not sure where in here I incorrectly use rdsk versus dsk? When mounting I reference the mount point not the device, so I’m not sure where I threw you off?

    Posted April 18, 2008, 12:07 pm

  4. You didn’t throw me off, its just something i pointed out to newbies that might read your blog. Nothing wrong with what you’ve written thats for sure. :)

    Posted April 18, 2008, 12:33 pm

  5. Thanks! :)

    Posted April 18, 2008, 12:48 pm

  6. Thank you! This really helped.

    Posted October 2, 2008, 10:17 am

  7. v.cool – you saved me a lot of work. BTW to get the mount to work on my system I had to have a – at the end of the entry in /etc/vfstab

    Posted October 30, 2008, 6:35 pm

  8. THANK YOU. You saved my life, especially the Virtual Image comment! THANK YOU!

    Posted November 18, 2008, 6:26 pm

  9. It is one of the solutions I got in the recent tymes. Many thanks

    Posted December 11, 2008, 2:46 pm

  10. When adding FC LUN to my Solaris machines:
    After a devfsadm
    I do a cfgadm -al
    And I don’t have to reboot to see the LUNs as disks in format.

    If your VM was using raw device mappings you would probably have similar success.

    Posted December 18, 2008, 5:26 pm

  11. Thank you all for this information! Thanks for keeping up community spirit by contributing and for taking the time to disseminate information :) <33333!

    Posted March 3, 2009, 10:13 pm

  12. i have never worked on Solaris before. but your instructions were very easy to follow and i mounted my new 250GB HD without any issue in one shot. Thank you… :-)

    Posted March 8, 2009, 2:38 am

  13. Hi, I got problem when do the mounting:

    bash-3.00# mount /data
    mount: Warning: Line for “/dev/dsk/c1t2d0s0” in vfstab has too few entries
    mount: Mount point cannot be determined

    bash-3.00# vi /etc/vfstab
    “/etc/vfstab” 16 lines, 611 characters
    #device device mount FS fsck mount mount
    #to mount to fsck point type pass at boot options
    #
    fd – /dev/fd fd – no –
    /proc – /proc proc – no –
    /dev/md/dsk/c1t0d0s1 – – swap – no –
    /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no –
    /dev/md/dsk/d3 /dev/md/rdsk/d3 /usr ufs 1 no –
    /dev/md/dsk/d5 /dev/md/rdsk/d5 /var ufs 1 no –
    /dev/md/dsk/d6 /dev/md/rdsk/d6 /export/home ufs 2 yes –
    /dev/md/dsk/d4 /dev/md/rdsk/d4 /opt ufs 2 yes –
    /dev/dsk/c1t2d0s0 /dev/rdsk/c1t2d0s0 /data ufs 2 yes
    /devices – /devices devfs – no –
    ctfs – /system/contract ctfs – no –
    objfs – /system/object objfs – no –
    swap – /tmp tmpfs – yes –
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    “/etc/vfstab” 16 lines, 617 characters

    Is there something wrong? I follow the step and all OK except the mounting process. Please help Thanks.

    Posted May 24, 2009, 11:04 pm

  14. Looks like you are missing the “-” at the end of the line. I rechecked my posting and apparently I missed it as well when I pasted it. I have now fixed the posting. Sorry for the delay!

    Posted May 25, 2009, 8:52 am

  15. Excellent! Thank you for sharing!

    Posted September 16, 2009, 11:29 am

  16. … helped me a lot.
    Thanks

    Posted October 8, 2009, 9:53 am

  17. Much appreciated!

    Posted October 8, 2009, 4:19 pm

  18. Great ! The whole process worked perfectly for me (a small Solaris 10 x86 server on which I just wanted to add an extra 500 GB for music, movies, etc ..)

    I’m a genuine newbie to Solaris and really, believe me or not, adding a hard drive to the system just looked like a huge pain in the .ss when I came to read sun’s doc on the matter (Solaris 10 system administrator collection) … until finally I found a straightforward method

    Thanks a lot to Kevin Pendleton

    R.TOUZARD

    Posted November 19, 2009, 6:37 pm

  19. Gracias! |
    Gracias! |
    Gracias! |
    Gracias! |
    Gracias! |> 1’000,000 :)
    …. |
    …. |
    Gracias! |
    Gracias! |

    Posted November 27, 2009, 4:51 pm

  20. Worked like a charm. Great tech tip.

    Posted December 24, 2009, 10:42 am

  21. […] Adding a Hard Drive to Solaris 10 Post a comment — Trackback URI RSS 2.0 feed for these comments This entry (permalink) was […]

    Posted February 22, 2010, 7:13 pm

  22. This was perfect, worked like a charm!

    Posted March 5, 2010, 12:16 pm

  23. […] Here’s how you would add a hard drive to Solaris 10, including the format, fdisk, partition, and then creation of the file system. http://www.utahsysadmin.com/2008/02/07/adding-a-hard-drive-to-solaris-10/ […]

    Posted May 19, 2010, 9:51 am

  24. Hey, this worked perfectly! I’m good at other UNIX OSs, but Solaris has always been a different animal for me. They way Solaris uses new drives and SAN Luns has been a sore spot, but I understand now. Thanks!

    Posted June 1, 2010, 6:53 pm

  25. Thanks, these instructions make this process easy.

    Posted August 6, 2010, 10:14 am

  26. Really good one for beginners of Solaris 10

    Posted September 25, 2010, 7:55 am

  27. Thank you so much for these easy to follow instructions. They help tremendously.

    Posted October 20, 2010, 9:47 am

  28. Thanks for clear instructions. A big help…i didn’t know the devfsadm command and it’s just what I was needing to find!

    Posted November 9, 2010, 1:53 pm

  29. Worked 100%, managed to attach the virtual scsi drive, very well written and clearly presented, really big help, thank you

    Posted December 3, 2010, 12:58 pm

  30. Worked for me,
    Thanks for this helpful information and sharing :)

    Posted February 21, 2011, 11:46 am

  31. Thanks! Saved me a lot of time!
    The same procedure works on SPARC as well (except the fdisk).
    I used this procedure to rename a partition.

    Posted May 4, 2011, 11:19 am

  32. very useful

    Posted May 18, 2011, 1:38 am

  33. HI Everybody ,

    Please help me out on this,Can you please investigate and write down how to add a new disk in X4170 from the Operating System ( not from the BIOS ).

    When we add or replace a disk in one of these Sun Fire boxes we typically need to bounce the box and create a volume from the controller application in the boot process but there is a way to do it from the operating system using an utility (a package has to be installed of course).

    if there is any thing like that can u pls post it , i will be very thankful guys.

    thanks,
    pradeep.

    Posted May 23, 2011, 12:32 pm

  34. Awsome.. thanks for sharing it .. it really helped.

    Posted May 26, 2011, 6:52 am

  35. muy buen aporte , he aprendi mucho
    gracias !!!!

    Posted July 14, 2011, 4:41 pm

  36. you’re a boss

    Posted September 12, 2011, 11:54 am

  37. Hi,

    in the post, while partitioning , you took the default partition TAG unassigned..but i know system allows u to create a file system on it.

    it’s better to specify partition TAG any other rather keeping it to unassigned.

    But suppose i want to change that partition type to USR (from unassigned)..is that i can change it directly from partition menu..is it possible without data loss. ?

    Posted October 15, 2011, 7:26 am

  38. what is the best way to change partition type TAG without any data loss ?

    Posted October 15, 2011, 7:28 am

  39. thank you, it helped me very well

    Posted June 10, 2012, 3:01 am

  40. TAKK og TAKK (THANKS)

    Posted July 12, 2012, 4:25 pm

  41. Wonderful, it saved me a lot of time. Many thanks

    Posted July 22, 2012, 2:05 pm

  42. Hi,

    before i saw this.. I Got stuck …!!! … did’t know what to do abt adding additional HDisk.. i could’t!!!

    Thanks!!!… Great one…!!!
    simple and most helpful!!!

    Just Keep on Rocking!!!
    :)

    Posted October 9, 2012, 1:09 am

  43. Thanks a lot, it was a great help..

    Posted December 23, 2012, 6:08 am

  44. Thanks! Saved me a lot of time!
    Great help.

    Posted September 3, 2013, 3:37 am

  45. Would the instructions be the same for Solaris 11? I followed your steps and they worked perfectly for Solaris 10. With 11, after ls /dev/rdsk/*s0, I see 6 drives before and after attaching the hard drive :(

    Posted December 4, 2013, 2:36 pm

  46. Thank you very much, direct, detailed and to the point.

    It was very helpful indeed.

    I think you can additional references to the vstab entry, would be even more helpful.

    Posted November 5, 2014, 3:12 am

  47. It works perfectly.
    Thank you.

    Posted March 17, 2015, 5:59 am

  48. This is very 2 helpfull doc.

    thanks to writer.

    Posted May 10, 2015, 1:18 pm

  49. Mohclip your contribution was very usefull!!! Thanks… in solaris 10, the correct directory is dsk instead rsk.

    Posted July 8, 2015, 9:25 am

  50. Thank you very much.. it works perfectly with me ..

    Posted January 13, 2016, 5:08 am

  51. it works
    Thank you very much……

    Posted September 7, 2016, 11:17 pm

Leave a reply