The Cuddletech Veritas Volume Manager Series: Volume Kreation: VxAssist & Ways to spend more time cuddling | ||
---|---|---|
Prev | Next |
In the VxMake tutorial we added disks using the helpful "vxdiskadm" ncurses app. Something you'll find is that most of the options you are given via "vxdiskadm" are not actually a part of the app, but rather it simply acts like a hub for them. This is really helpful for thoughs of us with bad memories who just can't remember the name or the args, but sometimes a quicker method is nice. Therefore we'll add in our disks this time using the "vxdiskadd" command. But before we do that, let's talk about Disk Groups (dg's), a topic we avoided for simplicity sake in the VxMake tutorial, but mentioned in the Krash Kourse.
Disk Groups are a method to segregate VM objects. Each system is required to have at least one disk group named "rootdg". You must have at least one disk in rootdg, whether you use it or not. The rootdg is used to store some fundimental information about the VM on the system so it's not an option. However we can create as many other disk groups as we like. Now, you might wonder why we don't simply do everything in rootdg all the time, like we did in the vxMake tutorial. There are two good reasons: first is that each disk group is "self contained", if you add 5 disk to a disk group and create a volume you ONLY have those 5 disks to work with (unless you add more to the DG, obviously) and therefore can be used as a sort of logical seperation from the rest of your storage subsystem. The second reason is that you can import and deport disk groups. When you import a disk group all volumes, disks, plexes, and any other objects in that disk group become usable by the system. When you deport a disk group all the objects and the disk group itself vanish from the system. If this seems vague, think of a file system; you create a filesystem on a disk, create files on it, etc. When you mount the filesystem all the contents are avalible and ready to use, the system is fully aware of that disks filesystem. But when you umount the filesystem suddenly all that data sort of "disappears" back into the darkness of it's disks... the data is there, you know it is, but unless that file system was noted in the /etc/vfstab a passerby wouldn't even know it exsisted. This is similar to the concept of disk groups. To illistrate why import/deporting of disk gropus is so powerful, lets again draw an analogy to a filesystem on disk: when you umount a filesystem on disk you suddenly have the option of taking that disk out of the system, putting it in another and by knowing what type of filesystem it is, and it's device number you can re-mount that filesystem on a completely diffrent system, which can be a real asset! You can do the same with disk groups! You can deport a disk group full of volumes, then move the disks with that disk group (you must move ALL of them, if you break up the disks it won't import) to another system where you simply import the disk group, a start all the volumes. You can see how useful that could be. For this reason, in this tutorial we will do all our example using an added options to almost all VxVM commands (the -g option) which specifies the disk group to work with. If you do not specify the disk group you are working with rootdg is assumed.
So let's start setting up our test enviorment for this course. First let's add our disks. We're going to add all disks in the A5100 (all 14) and we'll be adding them to a new disk group. We'll need to check the disks via "format", then use "vxdiskadd" to add them and put them in a disk group. Here we go..............
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t0d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135> /sbus@1f,0/SUNW,fas@e,8800000/sd@0,0 1. c0t1d0 <SUN4.2G cyl 3880 alt 2 hd 16 sec 135> /sbus@1f,0/SUNW,fas@e,8800000/sd@1,0 2. c1t0d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w2200002037096efd,0 3. c1t1d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020372d0f69,0 4. c1t2d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370971e8,0 5. c1t3d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w2200002037097752,0 6. c1t4d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370970f3,0 7. c1t5d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370d44c8,0 8. c1t6d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370d3926,0 9. c1t16d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370e0b08,0 10. c1t17d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370e85f8,0 11. c1t18d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370d3bef,0 12. c1t19d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370d44ee,0 13. c1t20d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w220000203714322b,0 14. c1t21d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370971df,0 15. c1t22d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133> /sbus@1f,0/SUNW,socal@1,0/sf@0,0/ssd@w22000020370d44d2,0 Specify disk (enter its number): ^D # # vxdiskadd c1 Add or initialize disks Menu: VolumeManager/Disk/AddDisks Here are the disks selected. Output format: [Device_Name] c1t0d0 c1t16d0 c1t17d0 c1t18d0 c1t19d0 c1t1d0 c1t20d0 c1t21d0 c1t22d0 c1t2d0 c1t3d0 c1t4d0 c1t5d0 c1t6d0 Continue operation? [y,n,q,?] (default: y) y You can choose to add these disks to an existing disk group, a new disk group, or you can leave these disks available for use by future add or replacement operations. To create a new disk group, select a disk group name that does not yet exist. To leave the disks available for future use, specify a disk group name of "none". Which disk group [<group>,none,list,q,?] (default: rootdg) cuddledg There is no active disk group named cuddledg. Create a new group named cuddledg? [y,n,q,?] (default: y) y Use default disk names for these disks? [y,n,q,?] (default: y) y Add disks as spare disks for cuddledg? [y,n,q,?] (default: n) n A new disk group will be created named cuddledg and the selected disks will be added to the disk group with default disk names. c1t0d0 c1t16d0 c1t17d0 c1t18d0 c1t19d0 c1t1d0 c1t20d0 c1t21d0 c1t22d0 c1t2d0 c1t3d0 c1t4d0 c1t5d0 c1t6d0 Continue with operation? [y,n,q,?] (default: y) y The following disk devices appear to have been initialized already. The disks are currently available as replacement disks. Output format: [Device_Name] c1t0d0 c1t16d0 c1t17d0 c1t18d0 c1t19d0 c1t1d0 c1t20d0 c1t21d0 c1t22d0 c1t2d0 c1t3d0 c1t4d0 c1t5d0 c1t6d0 Use these devices? [Y,N,S(elect),q,?] (default: Y) Y The following disks you selected for use appear to already have been initialized for the Volume Manager. If you are certain the disks already have been initialized for the Volume Manager, then you do not need to reinitialize these disk devices. Output format: [Device_Name] c1t0d0 c1t16d0 c1t17d0 c1t18d0 c1t19d0 c1t1d0 c1t20d0 c1t21d0 c1t22d0 c1t2d0 c1t3d0 c1t4d0 c1t5d0 c1t6d0 Reinitialize these devices? [Y,N,S(elect),q,?] (default: Y) Y Initializing device c1t0d0. Initializing device c1t16d0. Initializing device c1t17d0. Initializing device c1t18d0. Initializing device c1t19d0. Initializing device c1t1d0. Initializing device c1t20d0. Initializing device c1t21d0. Initializing device c1t22d0. Initializing device c1t2d0. Initializing device c1t3d0. Initializing device c1t4d0. Initializing device c1t5d0. Initializing device c1t6d0. Creating a new disk group named cuddledg containing the disk device c1t0d0 with the name cuddled01. Adding disk device c1t16d0 to disk group cuddledg with disk name cuddled02. Adding disk device c1t17d0 to disk group cuddledg with disk name cuddled03. Adding disk device c1t18d0 to disk group cuddledg with disk name cuddled04. Adding disk device c1t19d0 to disk group cuddledg with disk name cuddled05. Adding disk device c1t1d0 to disk group cuddledg with disk name cuddled06. Adding disk device c1t20d0 to disk group cuddledg with disk name cuddled07. Adding disk device c1t21d0 to disk group cuddledg with disk name cuddled08. Adding disk device c1t22d0 to disk group cuddledg with disk name cuddled09. Adding disk device c1t2d0 to disk group cuddledg with disk name cuddled10. Adding disk device c1t3d0 to disk group cuddledg with disk name cuddled11. Adding disk device c1t4d0 to disk group cuddledg with disk name cuddled12. Adding disk device c1t5d0 to disk group cuddledg with disk name cuddled13. Adding disk device c1t6d0 to disk group cuddledg with disk name cuddled14. Goodbye. # |
Great! We've just verified and added our disks and created a new disk group for them in the proccess! Some comments on what we did above. The format command and output is fairly obvious to all. But next we add the disks, and instead of using "vxdiskadm" like we did in the vxMake course, we opted to employ the "vxdiskadd" command instead. This command helps you add any disks given as it's arguments, given by SCSI id's. You can actually add disks in several ways.... Using the argument "all", which (duh) attempts to add all disks in the system to VxVM control, By specifing a controller number you can attempt to add all disks on a given controller, which is what we did (adding all disks on c1). The other method is to specify each disk individually (eg: vxdiskadd c1t3d0 c1t4d0 c1t5d0, which would add the 3 specified disks). I highly discourage anyone from using the "all" option.
Two other things I'd like you to notice in the above output is that I created the disk group by specifying the name of a disk group that didn't exsist. The VM took this as a hint to create it, which was confirmed by it's next questions after I told it to use "cuddledg" as the DG to add the disks to: "Create a new group named cuddledg?". That it's easy enough to get a nice new disk group to use. The second thing I wanted you to notice is the little suttle warning given to us during the addition. Just before it actually initializes the disks it warns that some of the disks have already been initialized before. This is important because you may be inadvertantly initializing disks in a deported DG or disks that were set aside after old VM usage. In our case, we see the warning because I create and destroy volumes and vmdisks on this array all the time, so it's just a friendly reminder to think before we continue.
One more thing before we move on. Notice that even though there is a default (just hit enter) answer for most questions we didn't use it! ALWAYS ANSWER THE QUESTIONS! And if you dont' you'll just like thoughs people on afterschool TV specials saying stupid things like "I never thought it'd happen to me! I thought I was special!". Just remember, mistakes get people fired from time to time, so don't take anything for granted that you don't have to.
Now, let's take a little "vxdisk list" peek at our disk configuration:
# vxdisk list DEVICE TYPE DISK GROUP STATUS c0t0d0s2 sliced - - error c0t1d0s2 sliced rootdisk rootdg online c1t0d0s2 sliced cuddled01 cuddledg online c1t1d0s2 sliced cuddled06 cuddledg online c1t2d0s2 sliced cuddled10 cuddledg online c1t3d0s2 sliced cuddled11 cuddledg online c1t4d0s2 sliced cuddled12 cuddledg online c1t5d0s2 sliced cuddled13 cuddledg online c1t6d0s2 sliced cuddled14 cuddledg online c1t16d0s2 sliced cuddled02 cuddledg online c1t17d0s2 sliced cuddled03 cuddledg online c1t18d0s2 sliced cuddled04 cuddledg online c1t19d0s2 sliced cuddled05 cuddledg online c1t20d0s2 sliced cuddled07 cuddledg online c1t21d0s2 sliced cuddled08 cuddledg online c1t22d0s2 sliced cuddled09 cuddledg online # |
Something about this that bothers me is that the names of the disks aren't very helpful. While we're discusing disks and disk groups let's explore how easy it is to rename objects. Using the tool "vxedit" we can easily rename any object. The only object that you should not rename is a volume, because the volume name is also a block device (/dev/vx/dsk/diskgroup/volume) and changing the block device can cause problems if you forget to update /etc/vfstab, not to mention the fact that you will need to umount the volume before you can change the name. Let's look at an example of how we can rename the disks in a way that's more helpful:
# vxedit -g cuddledg rename cuddled01 cuddle-f0 # vxedit -g cuddledg rename cuddled06 cuddle-f1 # vxedit -g cuddledg rename cuddled10 cuddle-f2 # vxedit -g cuddledg rename cuddled11 cuddle-f3 # vxedit -g cuddledg rename cuddled12 cuddle-f4 # vxedit -g cuddledg rename cuddled13 cuddle-f5 # vxedit -g cuddledg rename cuddled14 cuddle-f6 # vxedit -g cuddledg rename cuddled02 cuddle-r0 # vxedit -g cuddledg rename cuddled03 cuddle-r1 # vxedit -g cuddledg rename cuddled04 cuddle-r2 # vxedit -g cuddledg rename cuddled05 cuddle-r3 # vxedit -g cuddledg rename cuddled07 cuddle-r4 # vxedit -g cuddledg rename cuddled08 cuddle-r5 # vxedit -g cuddledg rename cuddled09 cuddle-r6 # vxdisk list DEVICE TYPE DISK GROUP STATUS c0t0d0s2 sliced - - error c0t1d0s2 sliced rootdisk rootdg online c1t0d0s2 sliced cuddle-f0 cuddledg online c1t1d0s2 sliced cuddle-f1 cuddledg online c1t2d0s2 sliced cuddle-f2 cuddledg online c1t3d0s2 sliced cuddle-f3 cuddledg online c1t4d0s2 sliced cuddle-f4 cuddledg online c1t5d0s2 sliced cuddle-f5 cuddledg online c1t6d0s2 sliced cuddle-f6 cuddledg online c1t16d0s2 sliced cuddle-r0 cuddledg online c1t17d0s2 sliced cuddle-r1 cuddledg online c1t18d0s2 sliced cuddle-r2 cuddledg online c1t19d0s2 sliced cuddle-r3 cuddledg online c1t20d0s2 sliced cuddle-r4 cuddledg online c1t21d0s2 sliced cuddle-r5 cuddledg online c1t22d0s2 sliced cuddle-r6 cuddledg online # |
You can see that the syntax for vxedit is pretty simple for renaming, the synatx is:
vxedit -g <diskgroup> rename <object_name> <new_object_name> |
In this way you can rename plexes, subdisks, vmdisks, you name it. The reason I've renamed the way I have is that in our case with an A5100 there are 7 disks in the front (f0-f6) and 7 in the rear (r0-r6) of the array. This gives me a quicker idea of which disks is where physically. But you must remember that this naming scheme is in no way perfect, because of the fact that a VM disks is not tied to a physical disk. I can tell VxVM to move a VM disk from one physical disk to another and the VM disk name won't change, and because the VM disks name is a physical representation of where the disk is I'll get the wrong impression. Therefore this naming convention only servers as a guide, not as a rule. Never trust a VM disks name. And the nice thing about vxedit is that you can do these renames online, and change them as often as you like. As always treat all VM commands with care.
Something to note in this course is that all of my commands will use a "-g" option which specifies the diskgroup to perform the action on (like you see in the vxedit syntax example above). You should ALWAYS specify the disk group, even if it's rootdg that your working on. If you do for some reason make a stupid mistake you want the damage to be as contained as possible, and specifying the disk group will help accomplish that.
So now that we've got our test setup ready to play with, let's take a preliminary look at our disk group and get on to the volume building!
# vxprint -g cuddledg -hrt DG NAME NCONFIG NLOG MINORS GROUP-ID DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE V NAME USETYPE KSTATE STATE LENGTH READPOL PREFPLEX PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE dg cuddledg default default 10000 1029129226.1248.gaff dm cuddle-f0 c1t0d0s2 sliced 3590 17678493 - dm cuddle-f1 c1t1d0s2 sliced 3590 17678493 - dm cuddle-f2 c1t2d0s2 sliced 3590 17678493 - dm cuddle-f3 c1t3d0s2 sliced 3590 17678493 - dm cuddle-f4 c1t4d0s2 sliced 3590 17678493 - dm cuddle-f5 c1t5d0s2 sliced 3590 17678493 - dm cuddle-f6 c1t6d0s2 sliced 3590 17678493 - dm cuddle-r0 c1t16d0s2 sliced 3590 17678493 - dm cuddle-r1 c1t17d0s2 sliced 3590 17678493 - dm cuddle-r2 c1t18d0s2 sliced 3590 17678493 - dm cuddle-r3 c1t19d0s2 sliced 3590 17678493 - dm cuddle-r4 c1t20d0s2 sliced 3590 17678493 - dm cuddle-r5 c1t21d0s2 sliced 3590 17678493 - dm cuddle-r6 c1t22d0s2 sliced 3590 17678493 - # |