- 论坛徽章:
- 0
|
Solaris Volume Manager is a software product that lets you manage large numbers
disks and the data on those disks. Although there are many ways to use Solaris
Volume Manager, most tasks include the following:
- Increasing storage capacity
- Increasing data availability
- Easing administration of large storage devices
In some instances, Solaris Volume Manager can also improve I/O performance.
Solaris Volume Manager uses virtual disks to manage physical disks and their
associated data. In Solaris Volume Manager, a virtual disk is called a volume. For
historical reasons, some command-line utilities also refer to a volume as a metadevice.
From the perspective of an application or a file system, a volume is functionally
identical to a physical disk. Solaris Volume Manager converts I/O requests directed at a volume into I/O requests to the underlying member disks.
RAID is an acronym for Redundant Array of Inexpensive (or Independent) Disks.
RAID refers to a set of disks, called an array or a volume, that appears to the user as a single large disk drive. Depending on the configuration, this array provides improved reliability, response time, or storage capacity.
format can not be used on volume, mkfs,mount,read,write can be used. A volume can be constructed from slices from different disks. Volume names are in /dev/md/dsk. you might name mirrors as follows: mirror d10, submirrors d11 and d12; mirror d20, submirrors d21, d22, d23, and d24.
1. test enviroment.
- 3 IDE disks, c0d0,c0d1,and c1d1. c0d0 is root, c0d1 used as /var/. c1d1 is free.
- 4 SCSI disks.
- c2t0d0 4G
- c2t1d0 8G
- c2t2d0 8G
- c2t3d0 4G
2. format
c2t0d0 format as follows,
Part Tag Flag Cylinders Size Blocks
0 root wm 1 - 50 100.00MB (50/0/0) 204800
1 swap wu 51 - 100 100.00MB (50/0/0) 204800
2 backup wu 0 - 2043 3.99GB (2044/0/0) 8372224
3 unassigned wm 101 - 150 100.00MB (50/0/0) 204800
4 unassigned wm 151 - 200 100.00MB (50/0/0) 204800
5 unassigned wm 201 - 250 100.00MB (50/0/0) 204800
6 usr wm 251 - 1993 3.40GB (1743/0/0) 7139328
7 unassigned wm 1994 - 2043 100.00MB (50/0/0) 204800
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 alternates wm 0 0 (0/0/0) 0
Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): scsi0
c2t3d0 is the same.
3. state database
The state database is a database that stores information about the state of your Solaris Volume Manager configuration. The state database records and tracks changes made to your configuration.Multiple copies of the state database protect against data loss from single points-of-failure.
1) Create state database replicas
-bash-3.00# metadb -a -f c2t0d0s7
-bash-3.00# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c2t0d0s7
-bash-3.00# metadb -a -c 2 c2t3d0s1
-bash-3.00# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c2t0d0s7
a u 16 8192 /dev/dsk/c2t3d0s1
a u 8208 8192 /dev/dsk/c2t3d0s1
2) Maintaining state database replicas
-bash-3.00# metadb -i
flags first blk block count
a u 16 8192 /dev/dsk/c2t0d0s7
a u 16 8192 /dev/dsk/c2t3d0s1
a u 8208 8192 /dev/dsk/c2t3d0s1
r - replica does not have device relocation information
o - replica active prior to last mddb configuration change
u - replica is up to date
l - locator for this replica was read successfully
-bash-3.00# metadb -d -f c2t0d0s7
-bash-3.00# metadb -i
flags first blk block count
a u 16 8192 /dev/dsk/c2t3d0s1
a u 8208 8192 /dev/dsk/c2t3d0s1
4. RAID-0(stripe and concatination) Volume
-bash-3.00# metainit -f d20 1 2 c2t0d0s2 c2t3d0s2
d20: Concat/Stripe is setup
-bash-3.00# newfs /dev/md/rdsk/d20
newfs: construct a new file system /dev/md/rdsk/d20: (y/n)? y
/dev/md/rdsk/d20: 16736256 sectors in 2724 cylinders of 48 tracks, 128 sectors
8172.0MB in 171 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
15831200, 15929632, 16028064, 16126496, 16224928, 16323360, 16421792,
16520224, 16618656, 16717088
-bash-3.00# mount /dev/md/dsk/d20 /mnt/
-bash-3.00# df
/mnt (/dev/md/dsk/d20 ):16465384 blocks 995900 files
==>to add a slice
-bash-3.00# metattach d20 c2t1d0s2
d20: component is attached
===>to remove
-bash-3.00# umount /mnt/
-bash-3.00# metaclear d20
d20: Concat/Stripe is cleared
5. RAID-1(Mirror)
A RAID-1 volume, or mirror, is a volume that maintains identical copies of the data in RAID-0 (stripe or concatenation) volumes. The RAID-0 volumes that are mirrored are called submirrors.
RAID-1+0 redundancy constitutes a configuration of mirrors that are then striped. RAID-0+1 redundancy constitutes a configuration of stripes that are then mirrored.The Solaris Volume Manager interface makes it appear that all RAID-1 devices are strictly RAID-0+1.
1) Create Mirror
-bash-3.00# metainit d51 1 1 c2t0d0s2
d51: Concat/Stripe is setup
-bash-3.00# metainit d52 1 1 c2t3d0s2
d52: Concat/Stripe is setup
-bash-3.00# metainit d50 -m d51 d52
metainit: d50: WARNING: This form of metainit is not recommended.
The submirrors may not have the same data.
Please see ERRORS in metainit(1M) for additional information.
d50: Mirror is setup
or
metainit d50 -m d51
metattach d50 d52
2) Create a two-way mirror from a file system
-bash-3.00# newfs /dev/rdsk/c2t0d0s2
newfs: /dev/rdsk/c2t0d0s2 last mounted as /mnt
newfs: construct a new file system /dev/rdsk/c2t0d0s2: (y/n)? y
/dev/rdsk/c2t0d0s2: 8372224 sectors in 2044 cylinders of 128 tracks, 32 sectors
4088.0MB in 79 cyl groups (26 c/g, 52.00MB/g, 6400 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 106560, 213088, 319616, 426144, 532672, 639200, 745728, 852256, 958784,
7350464, 7456992, 7563520, 7670048, 7776576, 7883104, 7989632, 8096160,
8202688, 8309216
-bash-3.00# mount /dev/dsk/c2t0d0s2 /mnt/
-bash-3.00# mkdir /mnt/testa
-bash-3.00# mkdir /mnt/testb
-bash-3.00# echo "test for a." >/mnt/testa/testa.txt
-bash-3.00# umount /mnt/
-bash-3.00# metainit -f d1 1 1 c2t0d0s2
metainit: jackv: c2t0d0s2: has appeared more than once in the specification of d51
-bash-3.00# metaclear d51
d51: Concat/Stripe is cleared
-bash-3.00# metaclear d52
d52: Concat/Stripe is cleared
-bash-3.00# metainit -f d1 1 1 c2t0d0s2
d1: Concat/Stripe is setup
-bash-3.00# metainit d2 1 1 c2t3d0s2
d2: Concat/Stripe is setup
-bash-3.00# metainit d0 -m d1
d0: Mirror is setup
-bash-3.00# mount /dev/md/dsk/d0 /mnt/
-bash-3.00# ls /mnt/
lost+found testa testb
-bash-3.00# metattach d0 d2
d0: submirror d2 is attached
(wait one minute)
-bash-3.00# umount /mnt/
-bash-3.00# mount /dev/dsk/c2t3d0s2 /mnt/
-bash-3.00# ls /mnt/
lost+found testa testb
(data has been mirror from c2t0d0s2 to c2t3d0s2)
-bash-3.00# metastat d0
d0: Mirror
Submirror 0: d1
State: Okay
Submirror 1: d2
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 8372224 blocks (4.0 GB)
d1: Submirror of d0
State: Okay
Size: 8372224 blocks (4.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c2t0d0s2 0 No Okay Yes
d2: Submirror of d0
State: Okay
Size: 8372224 blocks (4.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c2t3d0s2 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c2t0d0 Yes id1,sd@f3adf6e7c4641b2460008f9e40000
c2t3d0 Yes id1,sd@f3adf6e7c4652a45b000ca74f0002
3) Create mirror from root(/) file system
metainit, metattach, metaroot, lockfs,...(not tested.)
4) add submirror
-bash-3.00# metainit -f d3 1 1 c2t1d0s2
d3: Concat/Stripe is setup
-bash-3.00# metattach d0 d3
d0: submirror d3 is attached
-bash-3.00# metastat d0
d0: Mirror
Submirror 0: d1
State: Okay
Submirror 1: d2
State: Okay
Submirror 2: d3
State: Resyncing
Resync in progress: 5 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 8372224 blocks (4.0 GB)
d1: Submirror of d0
State: Okay
Size: 8372224 blocks (4.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c2t0d0s2 0 No Okay Yes
d2: Submirror of d0
State: Okay
Size: 8372224 blocks (4.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c2t3d0s2 0 No Okay Yes
d3: Submirror of d0
State: Resyncing
Size: 16760832 blocks (8.0 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c2t1d0s2 0 No Okay Yes
-bash-3.00# metadetach d0 d3
d0: submirror d3 is detached
===> to replace a failed slice
metareplace d3 c2t3d0s2 c2t2d0s2
6. Soft partitions
As the storage capacity of disks has increased, disk arrays present larger logical devices to Solaris systems.You can use soft partitions to divide a disk slice or logical volume into as many partitions as needed. You must provide a name for each division, or soft partition, just like you do for other storage volumes, such as stripes or mirrors.
-bash-3.00# metainit d20 -p c2t2d0s2 1g
d20: Soft Partition is setup
-bash-3.00# metainit d21 -p -e c2t1d0 8g (entire disk as soft partition)
===>expand soft partition
-bash-3.00# mount /dev/md/dsk/d20 /mnt/
-bash-3.00# metattach d20 1g
d20: Soft Partition has been grown
-bash-3.00# growfs -M /mnt/ /dev/md/rdsk/d20
/dev/md/dsk/d20 is mounted on /mnt, not /mnt/
7.RAID-5 volume
RAID level 5 is similar to striping, but with parity data distributed across all components (disk or logical volume). If a component fails, the data on the failed component can be rebuilt from the distributed data and parity information on the other components.
-bash-3.00# metainit d40 -r c2t0d0s2 c2t1d0s2 c2t2d0s2
d40: RAID is setup
-bash-3.00# metastat
d40: RAID
State: Initializing
Initialization in progress: 4.5% done
Interlace: 32 blocks
Size: 16732160 blocks (8.0 GB)
Original device:
Size: 16735552 blocks (8.0 GB)
Device Start Block Dbase State Reloc Hot Spare
c2t0d0s2 4426 No Initializing Yes
c2t1d0s2 4426 No Initializing Yes
c2t2d0s2 4426 No Initializing Yes
Device Relocation Information:
Device Reloc Device ID
c2t0d0 Yes id1,sd@f3adf6e7c4641b2460008f9e40000
c2t1d0 Yes id1,sd@f3adf6e7c4652a45b000ca74d0000
c2t2d0 Yes id1,sd@f3adf6e7c4652a45b000ca74e0001
(wait a while)
-bash-3.00# metastat
d40: RAID
State: Okay
Interlace: 32 blocks
Size: 16732160 blocks (8.0 GB)
Original device:
Size: 16735552 blocks (8.0 GB)
Device Start Block Dbase State Reloc Hot Spare
c2t0d0s2 4426 No Okay Yes
c2t1d0s2 4426 No Okay Yes
c2t2d0s2 4426 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c2t0d0 Yes id1,sd@f3adf6e7c4641b2460008f9e40000
c2t1d0 Yes id1,sd@f3adf6e7c4652a45b000ca74d0000
c2t2d0 Yes id1,sd@f3adf6e7c4652a45b000ca74e0001
===>add a contatenated slice to RAID-5
-bash-3.00# metattach d40 c2t3d0s2
d40: component is attached
-bash-3.00# metastat
d40: RAID
State: Okay
Initialization in progress: 36.4% done
Interlace: 32 blocks
Size: 16732160 blocks (8.0 GB)
Original device:
Size: 16735552 blocks (8.0 GB)
Device Start Block Dbase State Reloc Hot Spare
c2t0d0s2 4426 No Okay Yes
c2t1d0s2 4426 No Okay Yes
c2t2d0s2 4426 No Okay Yes
Concatenated Devices:
Size: 8367776 blocks (4.0 GB)
Device Start Block Dbase State Reloc Hot Spare
c2t3d0s2 4426 No Initializing Yes
Device Relocation Information:
Device Reloc Device ID
c2t0d0 Yes id1,sd@f3adf6e7c4641b2460008f9e40000
c2t1d0 Yes id1,sd@f3adf6e7c4652a45b000ca74d0000
c2t2d0 Yes id1,sd@f3adf6e7c4652a45b000ca74e0001
c2t3d0 Yes id1,sd@f3adf6e7c4652a45b000ca74f0002
8. Hot spare pools
A hot spare pool is collection of slices (hot spares) that Solaris Volume Manager uses to provide increased data availability for RAID-1 (mirror) and RAID-5 volumes. In a slice failure occurs, in either a submirror or a RAID-5 volume, Solaris Volume Manager automatically substitutes the hot spare for the failed slice.
A hot spare is a slice (not a volume) that is functional and available, but not in use. A hot spare is reserved, meaning that it stands ready to substitute for a failed slice in a submirror or RAID-5 volume.The hot spare can be used temporarily until the failed submirror or RAID-5 volume slice can either be fixed or replaced.
A submirror or RAID-5 volume can use only a hot spare whose size is equal to or greater than the size of the failed slice in the submirror or RAID-5 volume. If, for example, you have a submirror made of 1-Gbyte drives, a hot spare for the submirror must be 1 Gbyte or greater.
# metahs -a hsp001 /dev/dsk/c3t0d0s2
hsp001: Hotspare is added
# metahs -a -all /dev/dsk/c3t0d0s2
hsp001: Hotspare is added
hsp002: Hotspare is added
hsp003: Hotspare is added
# metaparam -h hsp100 d10
# metaparam -h hsp100 d11
9. Disk sets
A disk set is a set of physical storage volumes that contain logical volumes and hot spares.
Unlike local disk set administration, you do not need to manually create or delete disk set state databases. Solaris Volume Manager places one state database replica (on slice7) on each disk across all disks in the disk set, up to a maximum of 50 total replicas in the disk set.
When you add disks to a disk set, Solaris Volume Manager automatically creates the state database replicas on the disk set. When a disk is accepted into a disk set, Solaris Volume Manager might repartition the disk so that the state database replica for the disk set can be placed on the disk.
prtvtoc - report information about a disk geometry and par- titioning.
-bash-3.00# prtvtoc /dev/rdsk/c2t0d0s0
* /dev/rdsk/c2t0d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 32 sectors/track
* 128 tracks/cylinder
* 4096 sectors/cylinder
* 2046 cylinders
* 2044 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 0 00 4096 204800 208895
1 0 00 208896 204800 413695
2 5 01 0 8372224 8372223
3 0 00 413696 204800 618495
4 0 00 618496 204800 823295
5 0 00 823296 204800 1028095
6 0 00 1028096 7139328 8167423
7 0 00 8167424 204800 8372223
8 1 01 0 4096 4095
10. Volume manager
1) Expanding File System
After a volume that contains a UFS file system is expanded (meaning that more space is added), you also need to expand the file system in order to recognize the added space. You must manually expand the file system with the growfs command. The growfs command expands the file system, even while the file system is mounted. However, write access to the file system is not possible while the growfs command is running.
-bash-3.00# metainit d51 1 1 c2t0d0s2
d51: Concat/Stripe is setup
-bash-3.00# metainit d52 1 1 c2t3d0s2
d52: Concat/Stripe is setup
-bash-3.00# metainit d50 -m d51 d52
metainit: d50: WARNING: This form of metainit is not recommended.
The submirrors may not have the same data.
Please see ERRORS in metainit(1M) for additional information.
d50: Mirror is setup
-bash-3.00# mount /dev/md/dsk/d50 /mnt/
-bash-3.00# df -hk |grep d50
/dev/md/dsk/d50 3.9G 4.0M 3.9G 1% /mnt
-bash-3.00# metattach d51 c2t1d0s2
d51: component is attached
-bash-3.00# metattach d52 c2t2d0s2
d52: component is attached
(expand fs with growfs)
-bash-3.00# growfs -M /mnt /dev/md/rdsk/d50
/dev/md/rdsk/d50: 25128960 sectors in 6135 cylinders of 128 tracks, 32 sectors
12270.0MB in 236 cyl groups (26 c/g, 52.00MB/g, 6400 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 106560, 213088, 319616, 426144, 532672, 639200, 745728, 852256, 958784,
24071264, 24177792, 24284320, 24390848, 24497376, 24603904, 24710432,
24816960, 24923488, 25030016
-bash-3.00#
-bash-3.00# df -hk |grep d50
/dev/md/dsk/d50 12G 12M 12G 1% /mnt
(TBC)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38597/showart_308520.html |
|