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
1024+0 records in
1024+0 records out
# digest -a md5 file
f0252c61cab0d92ae0b91206af72f85d
2. Grow d51 partition by 1 GB and grow the filesystem
# metattach d51 1g
d51: Soft Partition has been grown
# growfs -M /oradata /dev/md/rdsk/d51
/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
f0252c61cab0d92ae0b91206af72f85d
Conclusion
In few sample steps we create volumes and filesystems, grow it without disrupting normal work of the system and applications. This example show the power of Solaris Volume manager, but of course do not cover many of the options and details you will need in daily work. For more information about the subject is strictly recommended to read official SUN documentation and related papers.
Showing posts with label soft partitions. Show all posts
Showing posts with label soft partitions. Show all posts
Play with soft partitions on Solaris part 3
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: 33091584 blocks (15 GB)
Original device:
Size: 33094272 blocks (15 GB)
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 330 No Okay Yes
c1t1d0s0 330 No Okay Yes
c1t2d0s0 330 No Okay Yes
c1t3d0s0 330 No Okay Yes
c1t4d0s0 330 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB302359a4-9d8f686a
c1t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB5a844d32-bae9afe7
c1t2d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBb0b0a9e8-72b6d075
c1t3d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBc7fe9534-5a7df964
c1t4d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB09918bf7-59adb880
3. Create filesystems
# newfs /dev/md/rdsk/d51
Warning: setting rpm to 60
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
Warning: setting rpm to 60
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
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: 33091584 blocks (15 GB)
Original device:
Size: 33094272 blocks (15 GB)
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 330 No Okay Yes
c1t1d0s0 330 No Okay Yes
c1t2d0s0 330 No Okay Yes
c1t3d0s0 330 No Okay Yes
c1t4d0s0 330 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB302359a4-9d8f686a
c1t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB5a844d32-bae9afe7
c1t2d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBb0b0a9e8-72b6d075
c1t3d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBc7fe9534-5a7df964
c1t4d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB09918bf7-59adb880
3. Create filesystems
# newfs /dev/md/rdsk/d51
Warning: setting rpm to 60
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
Warning: setting rpm to 60
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
Play with soft partitions on Solaris part 2
2. Create solaris partition on the disks
# fdisk -W /tmp/partition /dev/rdsk//c1t0d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t1d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t2d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t3d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t4d0p0
3. We will populate this disk map over the rest of the disks in automatic way to avoid human errors
# prtvtoc /dev/rdsk/c1t0d0s2 > /tmp/c1t0d0s2.toc
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t1d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t2d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t3d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t4d0s2
fmthard: New volume table of contents now in place
4. And create 2 copies of metadb on each of the 4 disks
# metadb -a -f -c 2 c1t0d0s7 c1t1d0s7 c1t2d0s7 c1t3d0s7 c1t4d0s7
5. Create RAID 5 array
# metainit d5 -r c1t0d0s0 c1t1d0s0 c1t2d0s0 c1t3d0s0 c1t4d0s0
d5: RAID is setup
6. And check the status of array
# metastat d5
d5: RAID
State: Okay
Interlace: 32 blocks
Size: 33091584 blocks (15 GB)
Original device:
Size: 33094272 blocks (15 GB)
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 330 No Okay Yes
c1t1d0s0 330 No Okay Yes
c1t2d0s0 330 No Okay Yes
c1t3d0s0 330 No Okay Yes
c1t4d0s0 330 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB302359a4-9d8f686a
c1t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB5a844d32-bae9afe7
c1t2d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBb0b0a9e8-72b6d075
c1t3d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBc7fe9534-5a7df964
c1t4d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB09918bf7-59adb880
# fdisk -W /tmp/partition /dev/rdsk//c1t0d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t1d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t2d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t3d0p0
# fdisk -F /tmp/partition /dev/rdsk//c1t4d0p0
3. We will populate this disk map over the rest of the disks in automatic way to avoid human errors
# prtvtoc /dev/rdsk/c1t0d0s2 > /tmp/c1t0d0s2.toc
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t1d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t2d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t3d0s2
fmthard: New volume table of contents now in place
# fmthard -s /tmp/c1t0d0s2.toc /dev/rdsk/c1t4d0s2
fmthard: New volume table of contents now in place
4. And create 2 copies of metadb on each of the 4 disks
# metadb -a -f -c 2 c1t0d0s7 c1t1d0s7 c1t2d0s7 c1t3d0s7 c1t4d0s7
5. Create RAID 5 array
# metainit d5 -r c1t0d0s0 c1t1d0s0 c1t2d0s0 c1t3d0s0 c1t4d0s0
d5: RAID is setup
6. And check the status of array
# metastat d5
d5: RAID
State: Okay
Interlace: 32 blocks
Size: 33091584 blocks (15 GB)
Original device:
Size: 33094272 blocks (15 GB)
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 330 No Okay Yes
c1t1d0s0 330 No Okay Yes
c1t2d0s0 330 No Okay Yes
c1t3d0s0 330 No Okay Yes
c1t4d0s0 330 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB302359a4-9d8f686a
c1t1d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB5a844d32-bae9afe7
c1t2d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBb0b0a9e8-72b6d075
c1t3d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VBc7fe9534-5a7df964
c1t4d0 Yes id1,sd@SATA_____VBOX_HARDDISK____VB09918bf7-59adb880
Play with soft partitions on Solaris part 1
Preamble
This manual is directed to show with practical example how to use soft partitions under Solaris. 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 5 harddisks, each with size of 4 GB, binded in RAID 5 array.
Prerequisites
1. First lets create partitions on the disks using s7 with size of 40 MB for metadb and s0 the rest for RAID 5 volume
bash-3.2# format
Searching for disks...
Inquiry failed for this logical diskdone
AVAILABLE DISK SELECTIONS:
0. c0d0 <ATA -VBOX HARDDISK -1.0 cyl 4174 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
1. c1t0d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@0,0
2. c1t1d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@1,0
3. c1t2d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@2,0
4. c1t3d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@3,0
5. c1t4d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@4,0
We select disk 1 allocated on controller 1
Specify disk (enter its number): 1
selecting c1t0d0
[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
Next step is to allocate the partition for Solaris on the disk
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
Enter in to the partition menu
format> pa
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
Create huge slice with number 0 for the array
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, 0e, 0.00mb, 0.00gb]: 2030
Allocate the rest of the diskspace in slice with number 7 for metadb
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]:2031
Enter partition size[0b, 0c, 20e, 0.00mb, 0.00gb]: 2043e
Print the partition table
partition> p
Current partition table (unnamed):
Total disk cylinders available: 2044 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wu 1 - 2030 3.96GB (2030/0/0) 8314880
1 unassigned wu 0 0 (0/0/0) 0
2 backup wu 1 - 2044 3.99GB (2044/0/0) 8372224
3 unassigned wu 0 0 (0/0/0) 0
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wu 0 0 (0/0/0) 0
6 unassigned wu 0 0 (0/0/0) 0
7 unassigned wu 2031 - 2043 26.00MB (13/0/0) 53248
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wu 0 0 (0/0/0) 0
And label and quit from format program
partition> la
Ready to label disk, continue? y
partition> q
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> q
This manual is directed to show with practical example how to use soft partitions under Solaris. 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 5 harddisks, each with size of 4 GB, binded in RAID 5 array.
Prerequisites
1. First lets create partitions on the disks using s7 with size of 40 MB for metadb and s0 the rest for RAID 5 volume
bash-3.2# format
Searching for disks...
Inquiry failed for this logical diskdone
AVAILABLE DISK SELECTIONS:
0. c0d0 <ATA -VBOX HARDDISK -1.0 cyl 4174 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
1. c1t0d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@0,0
2. c1t1d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@1,0
3. c1t2d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@2,0
4. c1t3d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@3,0
5. c1t4d0 <ATA -VBOX HARDDISK -1.0 cyl 2045 alt 2 hd 128 sec 32>
/pci@0,0/pci8086,2829@d/disk@4,0
We select disk 1 allocated on controller 1
Specify disk (enter its number): 1
selecting c1t0d0
[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
Next step is to allocate the partition for Solaris on the disk
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
Enter in to the partition menu
format> pa
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
Create huge slice with number 0 for the array
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, 0e, 0.00mb, 0.00gb]: 2030
Allocate the rest of the diskspace in slice with number 7 for metadb
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]:2031
Enter partition size[0b, 0c, 20e, 0.00mb, 0.00gb]: 2043e
Print the partition table
partition> p
Current partition table (unnamed):
Total disk cylinders available: 2044 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wu 1 - 2030 3.96GB (2030/0/0) 8314880
1 unassigned wu 0 0 (0/0/0) 0
2 backup wu 1 - 2044 3.99GB (2044/0/0) 8372224
3 unassigned wu 0 0 (0/0/0) 0
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wu 0 0 (0/0/0) 0
6 unassigned wu 0 0 (0/0/0) 0
7 unassigned wu 2031 - 2043 26.00MB (13/0/0) 53248
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wu 0 0 (0/0/0) 0
And label and quit from format program
partition> la
Ready to label disk, continue? y
partition> q
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> q
Subscribe to:
Posts (Atom)
Should I trust AI
Should I trust AI? So far no, sorry. I tested for the moment (May, 2025) most advanced model for programming and ask very simple question:...
-
Grow soft partition on the fly 1. Create random file and calculate checksum # cd /oradata # dd if=/dev/urandom of=file bs=1024 count=10...
-
There are some cases when you want to create compressed tar archive but you do not have enough disk space to keep original files and tar arc...
-
To build firewall under AIX is sample, but as each host based firewall should be done careful 1. Prerequisites To start firewall in AIX yo...