The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
vinum - A simple install to improve performance
10 August 1999
|
vinum is a great tool. As
the author says:
The vinum home page is at http://www.vinumvm.org/. There is also lost article by Jake Burkholder which I used for the basis of this exercise. You should read vinum(4) and vinum(8) and before continuing with this article. It explains the concepts and terms used within this article (such as plexes, subdisks, and volumes) and which are necessary if you wish to implement vinum. There is also an article by Jake Burkholder in FreeBSD'Zine |
Why use vinum?
|
Well, in my case, it was to create a larger volume and to increase performance. The box I was working on was destined to become the www and cvsup mirror for New Zealand FreeBSD User Group. But the box had only 1GB. So I removed those two 500MB drives and added in three 1GB drives. You may wish to read how I did the drive swap. If you wish to learn more about striping and RAID, please read http://www.lemis.com/vinum.html as I will not cover those topics at all. |
The best vinum resources
|
Remember your size
|
The first step was to figure out what size my disks were. My first attempts
involved assuming they were both 1GB drives. There weren't. And this caused
problems. So here's how to find out the size. The drives I'm using are SCSI
drives da1 and da2.
If you look above, you'll find that da1 is 1001MB and da2 is 1005MB. |
Disk partitions
|
I am assuming your have your disk partitions and slices ready to go. If you don't, please see Formatting Media For Use With FreeBSD but for your reference, my two disk are "dangerously" dedicated. |
Addenda - 26 August 1999
|
When I originally wrote the section on File System Types, my default editor was vi.
Then a reader sent me a message telling me telling me that that various UNIX
commands use the EDITOR command. Thus, you can set your default editor for various
commands. I thought that was brilliant! Of course I rushed off to write a new
article about that, only to find I'd already written one and forgotten about it! If you want to see how to set your default editor, see changing your default editor. |
File system types
|
vinum only works on vinum type file systems. By default, the
file systems are of type unused . You can change the file system type (fstype) to
"vinum" by using disklabel.
If you know how to use vi, then go ahead and ignore the following instructions. Otherwise this should help a big help:
Here is a properly configured disk:
|
Protect your data
|
The process of creating a vinum volume will erase the data which exists on the file system. If you are converting existing disks to use vinum, back up your data first. You can restore the data later. |
Create the configuration file
|
WARNING: Grey Lehey has said not to create striped plexes with a power of 2 stripe size. DO NOT USE THE 256k VALUES I USED. As mentioned in Jake's article, I used /etc/vinum.conf as my configuration file. Here is what it contains: drive d1 device /dev/da1e drive d2 device /dev/da2e volume test plex org striped 256k <==== do not use a power of 2 like I did sd length 1001m drive d1 sd length 1001m drive d2 See the vinum documentation for more information. The new volume device I am creating will be called test. Also note that I am striping and specifying the same size (1001MB) for both drives. This is despite that fact that one drive actually contains 1005 MB. See below for more information on the error messages I encountered when I didn't specify the correct sizes. man vinum also contains a "HOW TO SET UP VINUM" section which gives various options. Please refer to that when deciding what to put into your configuration file. |
Create the vinum devices
|
vinum uses it's own set of devices to implement what it needs to do what it
does best. These devices are located in /dev/vinum. To create
these devices, here's what I did:
|
Creating the new file system
|
The next step is to create the new file system. That's really easy actually.
The
|
Creation errors
|
If you don't change your fstype to vinum, you will get the following error when you
try to create.
Always check /var/log/messages after doing a vinum create. When I used the following configuration, I encountered my first problem:
But this configuration resulted in the following:
The log messages for this are:
So then I changed the configuration to:
And I tried again:
Well, that looks much better! We're making progress. At least, that's what I thought. Note the faulty and down entries in the above. And if you check the logs, you'll find.
And if you try the newfs, you'll get this:
So the moral of the story: always check /var/log/messages if encounter an unusual error. And please note that after every failed vinum create, you must reset your vinum configuration. See the next section for more detail on how to do that. |
Vinum reset
|
One thing to remember is that you sometimes have to remove your existing vinum
configuration. If you encounter any errors during the create, you should clear out
the vinum devices. This is because each create is cumulative. If youi keep
doing creates, you will wind up with more and more devices. Which is not necesarily
what you want. Please note that resetting the configuration does not delete your data but you must do another create with your original configuration. Here's how I cleared out the vinum configuration:
Don't use |
Mounting the vinum volume
|
This too is quite easy.
There you go! Welcome to the vinum world! And if I typed mount, here is what I found:
After all that, here is a set of successful logs from the above:
|
Making it all automagical
|
This section shows how I made sure the vinum volume was always mounted when
the system started up. First, I found the vinum options which are recognized by /etc/rc.conf.
Then I added the following to /etc/rc.conf.
Here's what I found in dmesg:
|