Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Absolute BSD - The Ultimate Guide To FreeBSD (2002).pdf
Скачиваний:
25
Добавлен:
17.08.2013
Размер:
8.15 Mб
Скачать

interactive mode.

Note The program name being the same as the feature name can confuse people. When talking about the whole Vinum system, the V is capitalized. The program always appears in the manual section (vinum(8)).

Vinum.conf

Vinum stores its actual configuration in a database on the disk, and you cannot read it without using vinum(8). You can create a vinum(8) configuration file, however, which is useful when initially configuring Vinum. You can check your initial setup work more easily when you have a configuration file, and you can change and rebuild your configuration without too much trouble when you track everything in a configuration file.

Once Vinum is configured, however, the configuration file is irrelevant; the actual configuration is stored in the on−disk database. You can make changes directly to the Vinum system without touching the configuration file. Do not look at the configuration file for current configuration information; remember to consult vinum(8) for the current setup.

Note In this chapter, I'll be using /etc/vinum.conf as a configuration file. If you come across this file on a system, just remember that it might not mean anything at all.

Concatenated Plex

We'll start by setting up a single concatenated volume to give us the biggest possible disk size. We'll use a single plex, or only one copy of the data. There is no redundancy in this model, but it will create a larger disk.

Here's an /etc/vinum.conf file for a concatenated plex:

...............................................................................................

drive alpha device /dev/da0s1e drive beta device /dev/da1s1e volume test

plex org concat

sd length 3243037k drive drive1 sd length 3457779k drive drive2

...............................................................................................

Have a look at the first two lines in this listing. The first thing we do is identify the drive partitions with the drive keyword. The two drives in this example are /dev/da0s1e and /dev/da1s1e. (Remember, in Vinum terms, partitions dedicated to Vinum are drives.) Each drive needs a unique name, and I've named them alpha and beta.

We then need to name our volume, or virtual partition, with the volume keyword. In this case, on the third line of the listing, I've named it test. Next, on the fourth line, we say how we're organizing our plex with the plex org keyword. We use concat to specify concatenation.

Finally, on the fifth and sixth lines, we tell Vinum the size of our subdisks on this drive. Remember, our original check with df showed us that /dev/da0s1e had 3243037KB available and /dev/da1s1e had 3457779KB available. We want to use all available space on these partitions for Vinum.

396

Note You can go into great detail about exactly how you want your volume set up, what sort of disk block and stripe size you want to use, and so on, but Vinum doesn't require that level of detail. It defaults to sensible values.

Creating the Volume

Now we create the volume with vinum create and the filename to tell Vinum to read your configuration and create everything:

...............................................................................................

# vinum create /etc/vinum.conf

 

 

 

 

v 2 drives:

 

 

 

 

 

D alpha

State: up

/dev/da0s1e

A: 384/3551 MB (10%)

D beta

State: up

/dev/da1s1e

A: 409/3786 MB (10%)

w 1 volumes:

 

 

 

 

 

V test

State: up

Plexes:

1 Size:

6543

MB

x 1 plexes:

 

 

 

 

 

P test.p0

C State: up

Subdisks:

2 Size:

6543

MB

y 2 subdisks:

 

 

 

 

 

S test.p0.s0

State: up

D: alpha

Size:

3167

MB

S test.p0.s1

State: up

D: beta

Size:

3376

MB

#

 

 

 

 

 

...............................................................................................

Read your vinum(8) output carefully to see if the result matches your understanding of your configuration file. Our most important indicator of success is that every entry has the state of up, which indicates that the operation was successful.

Let's have a look at this output. First we see our two drives, alpha and beta, both of which are up

(v). We also see the device names and the space usage.

Then we have a list of volumes (w). Our one volume appears, named test, with a total size of 6543MB. Similarly, we have one plex, with two subdisks (x). The plex is named after the volume name, with a trailing ".p0".

Finally, we see our subdisks and the drives that they were created on (y). Each subdisk is named after its volume, the plex it is assigned to, and an arbitrary subdisk number, such as test.p0.s1.

Our Vinum partition is now available. It will have a device name under /dev/vinum, named after the volume name. For example, our "test" volume is available as /dev/vinum/test.

Initializing Vinum Partitions

Before we can use our Vinum volume, it needs a filesystem. Since sysinstall doesn't recognize Vinum (yet!), you need to do this with newfs(8). If you're an experienced systems administrator, you can use any newfs flags you like to choose block sizes, and so on. The defaults work fine for most people:

...............................................................................................

# newfs −v /dev/vinum/test

...............................................................................................

397

You'll see newfs output scroll by, listing every superblock on the drive.

Once you have a filesystem, mount the drive and see what happens.

...............................................................................................

#mount /dev/vinum/test /mnt

 

 

 

#df

 

 

 

 

 

Filesystem

1K−blocks

Used

Avail Capacity Mounted on

/dev/ad4s1a

248111

55829

172434

24%

/

devfs

1

1

0

100%

/dev

/dev/ad4s1f

2032839

133492

1736720

7%

/test1

/dev/ad4s1g

2032839

1266476

603736

68%

/test2

/dev/ad4s1h

29497862

3974853 23163181

15%

/usr

/dev/ad4s1e

3048830

6757

2798167

0%

/var

procfs

4

4

0

100%

/proc

/dev/vinum/test 7282594

1

6699986

0%

/mnt

#

 

 

 

 

 

...............................................................................................

On the last line of the preceding df output, we see that our Vinum volume is ready and available for use, and that it's roughly the combined size of the two smaller disks we used to create the volume! (If you want more human−readable output, try df −h to see disk space in a more friendly manner.)

...............................................................................................

/dev/vinum/test 7282594 1 6699986 0% /mnt

...............................................................................................

As you can see, concatenating disks is useful for combining several small disks into one large one, giving new life to older or smaller disks. While this doesn't give us any reliability, it does help make older and smaller disks useful again. Other uses of Vinum are more interesting, such as striping.

Let's see how that works by turning these two disks into a striped system.

Removing Vinum Configuration

Vinum uses an accumulative configuration process. If you don't destroy your old configuration, any new configuration is simply added to it. Accumulative configuration works well when you're adding disks to a RAID system or restoring a damaged volume. It works poorly when you just want to start over. This is reasonable—after all, most people in a production system alter a configuration more frequently than they erase it and start over!

To start from scratch, you must erase the existing configuration from the on−disk database. You cannot just edit the configuration file, because it has no real relationship to Vinum's internal operations.

To get rid of our existing Vinum configuration and the mounted partitions, we must first unmount the existing Vinum partition. (It is always a poor idea to destroy anything while the operating system is using it.)

Once the Vinum partition is safely unmounted, we can destroy the existing configuration. In the following example, we'll use vinum's interactive mode. Type vinum at the command line to drop into a vinum shell.

398

...............................................................................................

# vinum

vinum –>

...............................................................................................

Here you can enter vinum(8) commands and interact more directly with the system. You can start over with the resetconfig command:

...............................................................................................

vinum –> resetconfig

WARNING! This command will completely wipe out your vinum configuration. All data will be lost. If you really want to do this, enter the text

NO FUTURE Enter text –>

...............................................................................................

Yes, that's NO FUTURE in all caps. It's Vinum's subtle way of reminding you that you're about to absolutely destroy any data on that partition, as well as your configuration. If you're not certain, just hit ENTER to go back to the main vinum prompt. If you're sure, enter NO FUTURE and hit ENTER.

...............................................................................................

Enter text –> NO FUTURE

Vinum configuration obliterated

vinum –>

...............................................................................................

Press CONTROL−D to leave vinum. You now have no Vinum configuration and are ready to build a new one.

Striped Volumes

The vinum.conf file that follows shows a striped volume. (Remember, a striped volume spreads its data between two disks.)

...............................................................................................

drive alpha device /dev/da0s1e drive beta device /dev/da1s1e volume test

plex org striped 279k

sd length 3243037k drive alpha sd length 3243037k drive beta

...............................................................................................

This looks quite similar to the concatenated setup, with some minor changes. We still have our alpha and beta drives, and the volume name is still test.

The plex org keyword has changed to striped and a number. The number at the end of the plex setup line indicates the stripe size; the amount of data that will be written to one drive before switching to the other drive. The 279KB (279k) shown here is a reasonable default.

Note Why use such a weird size for the stripe? Well, Vinum and the filesystem have

399