Pages

Wednesday, December 15, 2010

How to change disk partition on Solaris

In Solaris you can change disk partition using format utility. If you want to change partition size of a partition that already mounted, unmount that partition first. See simple tips below

  1. Become super user
  1. Type format
The format output will be like this :

root@solaris-sunray # format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
  1. Choose the disk
Specify disk (enter its number): 0
selecting c0d0
Controller working list found
[disk formatted, defect list found]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0d0s1 is currently used by swap. Please see swap(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
show - translate a disk address
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
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit

  1. Type partition
format> partition

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

  1. Type print to see disk partition map
partition> print
Current partition table (original):
Total disk cylinders available: 2085 + 2 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 70 - 2084 15.44GB (2015/0/0) 32370975
1 swap wu 3 - 68 517.72MB (66/0/0) 1060290
2 backup wm 0 - 2084 15.97GB (2085/0/0) 33495525
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 7.84MB (1/0/0) 16065
9 alternates wu 1 - 2 15.69MB (2/0/0) 32130


  1. Choose disk partition that you want change
partition> 0
Part Tag Flag Cylinders Size Blocks
0 root wm 70 - 2084 15.44GB (2015/0/0) 32370975

Enter partition id tag[root]:
Enter partition permission flags[wm]:
Enter new starting cyl[70]:
Enter partition size[32370975b, 2015c, 2084e, 15806.14mb, 15.44gb]:

  1. After change partition you must label it
partition> label
Ready to label disk, continue? Yes

  1. Quit format utility
partition> quit
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
show - translate a disk address
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
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> quit

  1. Save your disk partition configuration onto text file. You can use this text file later to restore your disk partition configuration if your configuration is lost.
root@solaris-sunray # prtvtoc /dev/rdsk/c0d0s0 > c0d0s0-vtoc.txt
root@solaris-sunray # more c0d0s0-vtoc.txt
* /dev/rdsk/c0d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 2087 cylinders
* 2085 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 1108485 16065 1124549
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 1124550 32370975 33495524 /
1 3 01 48195 1060290 1108484
2 5 00 0 33495525 33495524
8 1 01 0 16065 16064
9 9 01 16065 32130 48194

No comments:

Post a Comment