> /dev/dsk/c1d0s1 - - swap - no - > /dev/dsk/c1d0s0 /dev/rdsk/c1d0s0 / ufs 1 no -
Here is a little step-by-step guide to create a soft mirror from the
root
file system, known as an encapsulation of the system's disk.
This will provide full protection against one disk failure, and complete
redundancy. In the same time, this will have the effect to speed read
requests (since there exists multiple backing devices hosting the same
data), but write performance is generally degraded. First, know your
running system, particularly on which disk it is currently installed and
which other device is available for the second mirror side.
# df -hF ufs
Filesystem size used avail capacity Mounted on
/dev/dsk/c1d0s0 7.9G 5.2G 2.6G 67% /
# swap -lh
swapfile dev swaplo blocks free
/dev/dsk/c1d0s1 102,65 4K 4.0G 4.0G
#
# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1d0
/pci@0,0/pci-ide@8/ide@0/cmdk@0,0
1. c2d0
/pci@0,0/pci-ide@8/ide@1/cmdk@0,0
[...]
Well, we will use the c2d0
as the second submirror. So, we need to
default to one Solaris partition that uses the whole disk and make it
bootable (we are using GRUB in this case). The slice for the second
submirror must have a slice tag of root and the root slice must be
slice 0
(so, we will duplicate the label's content from the boot disk
to the mirror disk).
# fdisk -B /dev/rdsk/c2d0p0
# fdisk /dev/rdsk/c2d0p0
Total disk size is 36483 cylinders
Cylinder size is 16065 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 36482 36482 100
SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Exit (update disk configuration and exit)
6. Cancel (exit without updating disk configuration)
Enter Selection:
#
# prtvtoc /dev/rdsk/c1d0s2 | fmthard -s - /dev/rdsk/c2d0s2
fmthard: New volume table of contents now in place.
#
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c2d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 260 sectors starting at 50 (abs 16115)
Create replicas of the metadevice state database:
# metadb -a -c 3 -f c1d0s4 c2d0s4
# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c1d0s4
a u 8208 8192 /dev/dsk/c1d0s4
a u 16400 8192 /dev/dsk/c1d0s4
a u 16 8192 /dev/dsk/c2d0s4
a u 8208 8192 /dev/dsk/c2d0s4
a u 16400 8192 /dev/dsk/c2d0s4
Flag -f
is needed because it is the first invocation/creation of
metadb(1m)
.
Set up the RAID-0 metadevices (stripe or concatenation volumes)
corresponding to the /
file system and the swap
space, and
automatically configure system files (/etc/vfstab
and /etc/system
)
for the root
metadevice.
# metainit -f d10 1 1 c1d0s0
d10: Concat/Stripe is setup
# metainit -f d11 1 1 c1d0s1
d11: Concat/Stripe is setup
# metainit d20 1 1 c2d0s0
d20: Concat/Stripe is setup
# metainit d21 1 1 c2d0s1
d21: Concat/Stripe is setup
# metainit d0 -m d10
d0: Mirror is setup
# metainit d1 -m d11
d1: Mirror is setup
#
# cp /etc/vfstab /etc/vfstab.beforesvm
# sed -e 's@/dev/dsk/c1d0s1@/dev/md/dsk/d1@' /etc/vfstab.beforesvm > /etc/vfstab
# metaroot d0
# diff /etc/vfstab /etc/vfstab.beforesvm
6,7c6,7
< /dev/md/dsk/d1 - - swap - no -
< /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -