Home
About this site:
Disclaimer
Change your settings,
Setup
links to other sites on this server:
Birds
Insects
Edimax mod
Webserver on Edimax
Mailserver on Edimax
links to other sites:
Tranquil PC
Ubuntu Linix kernels
Put Linux on a memory stick
grub2 manuals in progress

Mirroring, logical volumes, virtual disks

How to turn a few available (but odd, unequally sized) disks into some useable (virtual) filesystems.

Mirroring and backups

Mirroring is NOT an alternative to making backups. So mirroring your disks is part of the solution.

Mirroring - aka Raid-1

Mirroring disks (also known as Raid-0) makes your computer writes all data write onto 2 disks at the same time. If one disk fails, no data is lost. Just replace the faulty disk.
Reading data may be faster, since there are 2 disks available to read from.
The disadvantages: you have to buy twice the amount of disk surface, writing data may cost twice the time.

Mirroring protects you from disk failures, Not from you accidently deleting files. So it is NOT an alternative ro making backups.
Of course you can make a (compressed) backup to disk, if you have enough space.

Raid-0 and Raid-5

Raid-o maintains 2 copies of every file on 2 different disks. They may be written (almost) at the same time. It costs twice the amounts of disks. It hardly gives extra CPU load, since no computations are involved.
Raid-5 is cheaper: for every disk block it maintains a smaller parity block on another disk. So you have more disk surface or your money. But the drawback is: the parity table is recreated every time when the block is written. It costs extra CPU time.

Hardware mirroring

The BBS comes with a Raid-controller. It is capable of mirroring 2 pairs of identical disks.

The rightmost disk (connected to the motherboard, not to the Raid controller) cannot be part of a hardware mirror.

Software mirroring

Software mirroring supports pairs of equally sized disks or partitions to create mirrored devices, so the disks need not to be paired.

It also supports mirroring of partitions on all 5 disks, not excluding the rightmost disk. You could even throw in some USB disks or floppies.

However, if you want to mirror partitions of an odd number of disks, or several (at least 3) disks of unequal sizes, you may end-up with a lot of useless small mirrored partitions. That is why Logical Volumes is invented.

Logical volumes, logical disks

You may have several odd sized disk, due to several reasons - still using good old disks of different sizes - result of softare mirroring Usually you need other partition sizes to store your fotos, music, etc. The Logical Volume Manager (LVM) can throw all blocks of odd-sised available devices into a pool of disk blocks, and then assemble the useable devices as large as you need them.

There is no relationship between the sizes of the physical disks and the logical disks as long as the total size of logical disks is not more than the physical disk surface.

So what shall we do ?

There are a few rules to obey: Based on this, the following decisions were made, (on which this document is based): The rest of this document is based on these decisions !

Example how to turn available partitions into useable disks

with thanks to Ton Hospel for the idea

Disk /dev/sdb is partitioned into /dev/sdb1, /dsv/sdb2, /dev/sdb3.

The partitions sdd1 and sdb3 are equally sized, and combined into 1 single mirrored device /dev/md1.

The mirrored devices /dev/md[1-9] are combined into a group named /dev/all_disks.

Half of /dev/md4 is missing, since disk /dev/sda isn't available at the moment. But it still works !

Then the volume group /dev/all_disks is devided into usefull logical volumes, like /home, /var, / (root), and possible /var/www (website), /var/music (music files) as you wish. You just need to add root while installing, you can do the rest later.

physical devices mirrored devices logical volume group logical volume mounted as
/dev/sdd1
/dev/sdb3
/dev/md1 /dev/all_disks /dev/all_disks/home/home
/dev/sdc2
/dev/sdb4
/dev/md2 /dev/all_disks/var/var
/dev/sdc3
/dev/sdd2
/dev/md3 /dev/all_disks/root/
/dev/sdb2
missing
/dev/md4 /dev/all_disks/log/var/log
/dev/sdc1
/dev/sdb1
/dev/md0 Used as mirrored boot device,
NOT part of logical volumes.
/boot

Note the devices /dev/sdb1 and /dev/sdc1 are NOT part of the logical volumes.
sdb1 and sdb1 are both partitions of only 7 cylinders, 150 MBytes each, combined together to a mirrord device /dev/md0, also 150 MBytes. At startup-time, the system is booted from /dev/md0, if at least 1 of /dev/sdb1 or /dev/sdc1 is working properly.


For remarks about this page, click here email: philip@van.geens.nl