Contents
- 1 Preamble
- 2 Prerequisites
- 3 Creation of soft partitions
- 4 Grow soft partition on the fly
- 5 Conclusion
Preamble
This manual is directed to show with practical example how to use soft partitions underSolaris. The advantages of soft partitions compared to standard Solaris slices are possibility to create up to 8192 partitions compared to 7 in slices and grow on the fly the partitions without disrupting normal operations. Of course last one is true only in case of use filesystem over the soft partition, but this is usual situation, raw partitions are in use much rare. Example will be based on soft partitions reside over 4 harddisks, size of 2 GB, binded in RAID 5 array.
Prerequisites
1. First lets create partitions on the disks using s7 with size of 20 MB for metadb and s0 the rest for RAID 5 volume
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 4092 alt 2 hd 128 sec 32> /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0 1. c2t0d0 <DEFAULT cyl 1020 alt 2 hd 128 sec 32> /pci@0,0/pci1000,30@10/sd@0,0 2. c2t1d0 <DEFAULT cyl 1020 alt 2 hd 128 sec 32> /pci@0,0/pci1000,30@10/sd@1,0 3. c2t2d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,30@10/sd@2,0 4. c2t3d0 <DEFAULT cyl 1021 alt 2 hd 128 sec 32> /pci@0,0/pci1000,30@10/sd@3,0 Specify disk (enter its number): 1 selecting c2t0d0 [disk formatted] 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> fd 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 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> 7 Part Tag Flag Cylinders Size Blocks 7 unassigned wm 0 0 (0/0/0) 0 Enter partition id tag[unassigned]: Enter partition permission flags[wm]: Enter new starting cyl[0]: 1010 Enter partition size[0b, 0c, 1010e, 0.00mb, 0.00gb]: 10c 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]: 1009c partition> p Current partition table (unnamed): Total disk cylinders available: 1020 + 2 (reserved cylinders) Part Tag Flag Cylinders Size Blocks 0 unassigned wm 1 - 1009 1.97GB (1009/0/0) 4132864 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 1010 - 1019 20.00MB (10/0/0) 40960 8 boot wu 0 - 0 2.00MB (1/0/0) 4096 9 unassigned wm 0 0 (0/0/0) 0 partition> la Ready to label disk, continue? y partition> q
2. We will populate this disk map over the rest of the disks in automatic way to avoid human errors
# prtvtoc /dev/rdsk/c2t0d0s2 > /tmp/c2t0d0s2.toc # fmthard -s /tmp/c2t0d0s2.toc /dev/rdsk/c2t1d0s2 # fmthard -s /tmp/c2t0d0s2.toc /dev/rdsk/c2t2d0s2 # fmthard -s /tmp/c2t0d0s2.toc /dev/rdsk/c2t3d0s2
3. And create 2 copies of metadb on each of the 4 disks
# metadb -a -f -c 2 c2t0d0s7 c2t1d0s7 c2t2d0s7 c2t3d0s7 # metadb flags first blk block count a u 16 8192 /dev/dsk/c2t0d0s7 a u 8208 8192 /dev/dsk/c2t0d0s7 a u 16 8192 /dev/dsk/c2t1d0s7 a u 8208 8192 /dev/dsk/c2t1d0s7 a u 16 8192 /dev/dsk/c2t2d0s7 a u 8208 8192 /dev/dsk/c2t2d0s7 a u 16 8192 /dev/dsk/c2t3d0s7 a u 8208 8192 /dev/dsk/c2t3d0s7
4. Create RAID 5 array and check it
# metainit d5 -r c2t0d0s0 c2t1d0s0 c2t2d0s0 c2t3d0s0 d5: RAID is setup # metastat d5 d5: RAID State: Okay Interlace: 32 blocks Size: 12394496 blocks (5.9 GB) Original device: Size: 12397536 blocks (5.9 GB) Device Start Block Dbase State Reloc Hot Spare c2t0d0s0 330 No Okay Yes c2t1d0s0 330 No Okay Yes c2t2d0s0 330 No Okay Yes c2t3d0s0 330 No Okay Yes Device Relocation Information: Device Reloc Device ID c2t0d0 Yes id1,sd@f01390bd648bd7cc40005eded0000 c2t1d0 Yes id1,sd@f01390bd648bd7cc40006c51a0001 c2t2d0 Yes id1,sd@f01390bd648bd7cc4000819810002 c2t3d0 Yes id1,sd@f01390bd648bd7cc400094ba30003
Creation of soft partitions
1. Create on soft partition of 3 gigabytes with name d51 and another with size 1.5G and name d52
# metainit d51 -p d5 3g d51: Soft Partition is setup # metainit d52 -p d5 1500m d52: Soft Partition is setup
2. Check the status of d52 for example
# metastat d52 d52: Soft Partition Device: d5 State: Okay Size: 3072000 blocks (1.5 GB) Extent Start Block Block count 0 6291520 3072000 d5: RAID State: Okay Interlace: 32 blocks Size: 12394496 blocks (5.9 GB) Original device: Size: 12397536 blocks (5.9 GB) Device Start Block Dbase State Reloc Hot Spare c2t0d0s0 330 No Okay Yes c2t1d0s0 330 No Okay Yes c2t2d0s0 330 No Okay Yes c2t3d0s0 330 No Okay Yes Device Relocation Information: Device Reloc Device ID c2t0d0 Yes id1,sd@f01390bd648bd7cc40005eded0000 c2t1d0 Yes id1,sd@f01390bd648bd7cc40006c51a0001 c2t2d0 Yes id1,sd@f01390bd648bd7cc4000819810002 c2t3d0 Yes id1,sd@f01390bd648bd7cc400094ba30003
3. Create filesystems
# newfs /dev/md/rdsk/d51 /dev/md/rdsk/d51: Unable to find Media type. Proceeding with system determined parameters. newfs: construct a new file system /dev/md/rdsk/d51: (y/n)? y /dev/md/rdsk/d51: 6291456 sectors in 1536 cylinders of 128 tracks, 32 sectors 3072.0MB in 62 cyl groups (25 c/g, 50.00MB/g, 8192 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 102464, 204896, 307328, 409760, 512192, 614624, 717056, 819488, 921920, 5326496, 5428928, 5531360, 5633792, 5736224, 5838656, 5941088, 6043520, 6145952, 6248384 # newfs /dev/md/rdsk/d52 /dev/md/rdsk/d52: Unable to find Media type. Proceeding with system determined parameters. newfs: construct a new file system /dev/md/rdsk/d52: (y/n)? y /dev/md/rdsk/d52: 3072000 sectors in 750 cylinders of 128 tracks, 32 sectors 1500.0MB in 33 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, 2167552, 2261792, 2356032, 2450272, 2544512, 2638752, 2732992, 2827232, 2921472, 3015712
4. Then create mountpoints, mount filesystems and check the mount
# mkdir /oradata /oralogs # mount /dev/md/dsk/d51 /oradata # mount /dev/md/dsk/d52 /oralogs # df -k|grep \/md\/ /dev/md/dsk/d51 3081231 3089 3016518 1% /oradata /dev/md/dsk/d52 1488991 1521 1427911 1% /oralogs
Grow soft partition on the fly
1. Create random file and calculate checksum
cd /oradata dd if=/dev/urandom of=file bs=1024 count=1024 # digest -a md5 file 033faac18a38210441aef4a4c434c4fc
2. Grow d51 partition by 1 GB and grow the filesystem
# metattach d51 1g # growfs -M /oradata /dev/md/rdsk/d51 /dev/md/rdsk/d51: Unable to find Media type. Proceeding with system determined parameters. /dev/md/rdsk/d51: 8388608 sectors in 2048 cylinders of 128 tracks, 32 sectors 4096.0MB in 82 cyl groups (25 c/g, 50.00MB/g, 8192 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 102464, 204896, 307328, 409760, 512192, 614624, 717056, 819488, 921920, 7375136, 7477568, 7580000, 7682432, 7784864, 7887296, 7989728, 8092160, 8194592, 8297024
3. See the mounted soft partitions and check if the file is the same
# df -k|grep \/md\/ /dev/md/dsk/d51 4109006 5145 4042237 1% /oradata /dev/md/dsk/d52 1488991 1521 1427911 1% /oralogs # digest -a md5 file 033faac18a38210441aef4a4c434c4fc
No comments:
Post a Comment