Solaris - Disk Repartitioning
Yesterday, I had to do some Raid-1 configuration for Sun V490s. One problem was harddisks were already formatted and partitioned but in order to make Raid-1 configuration work on all servers (x4) , I had to repartition them first then make mirror configuration. What I found out at the end is that solaris disk repartitioning is comparably much easier then windows and any other operating systems unless you are trying to repartition system partitions like root or swap. I used ‘format’ utility for all steps. Here are the details:
Initial hard drive slices look as below:
| Part 0 1 2 3 4 5 6 7 |
Tag root swap backup unassigned unassigned var usr unassigned |
Flag wm wu wm wm wm wm wm wm |
Cylinders 202 - 1308 0 - 201 0 - 14086 0 0 1309 - 1912 1913 - 5004 0 |
Size 10.74GB 1.96GB 136.71GB 0 0 5.86GB 30.01GB 0 |
Blocks (1107/0/0) 22529664 (202/0/0) 4111104 (14087/0/0) 286698624 (0/0/0) 0 (0/0/0) 0 (604/0/0) 12292608 (3092/0/0) 62928384 (0/0/0) 0 |
How it should look like at the end as below:
| Part 0 1 2 3 4 5 6 7 |
Tag root swap backup usr unassigned var unassigned unassigned |
Flag wm wu wm wm wm wm wm wm |
Cylinders 202 - 1308 0 - 201 0 - 14086 1913 - 5004 0 1309 - 1912 0 0 |
Size 10.74GB 1.96GB 136.71GB 30.01GB 0 5.86GB 0 0 |
Blocks (1107/0/0) 22529664 (202/0/0) 4111104 (14087/0/0) 286698624 (3092/0/0) 62928384 (0/0/0) 0 (604/0/0) 12292608 (0/0/0) 0 (0/0/0) 0 |
Before starting to play with ‘format’ utility, /etc/vfstab should be changed and mounted partitions either should be removed or commented out. Otherwise you will get an error saying, the partition you are trying to modify is already mounted.
After you’ve changed /etc/vfstab; you should modify slice 3 by putting same cylinders range with 6. That range starts with 1913 and you should put 30 gb. for the size, ending cylinder (5004) will be calculated automatically. Here we go:
#root etc>format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w500000e011e5faf1,0
1. c1t1d0
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w500000e011e609d1,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).
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
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
! - execute , then return
quit
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
! - execute , then return
quit
partition> 3
Part Tag Flag Cylinders Size Blocks
3 unassigned
wm 0 0 (0/0/0)Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 1913
Enter partition size[0, 0c, 0e, 0mb, 0gb]: 30gb
partition> label
Ready to label disk, continue? y
Now you assigned ranges to slice 3 and saved configuration. Next step is to delete older one by giving 0 for number of cylinders and disk size:
partition> 6
Part Tag Flag Cylinders Size Blocks
6 usr wm 1913 - 5004 30.01GB (3092/0/0) 62928384
Enter partition id tag[usr]:
Enter partition permission flags[wm]:
Enter new starting cyl[1913]: 0
Enter partition size[62928384b, 3092c, 3091e, 30726.75mb, 30.01gb]: 0
partition> label
Ready to label disk, continue? y
One problem I face with when I issued ‘label’ command was:
> label
Cannot label disk when partitions are in use as described.
And the solution for this:
The environment variable NOINUSE_CHECK (see PSARC/2005/461), when set, can be used to turn off this new functionality:
NOINUSE_CHECK=1
export NOINUSE_CHECK
Update your ~/.profile!
Benzer yazılar: