Čt. Dub 18th, 2024

Tento návod jsem hledal už hodně dlouho a opravdu ho mohu doporučit komukoliv kdo začíná na debianech či ubuntu a pracuje se softwarovým RAIDem.

sudo fdisk -l

This will output, for each drive you have, something along the lines of:

Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000f1f05

There may well be slightly more information available too if you already have some partitions made. From here note the name of the drives you wish to use (for example, /dev/sda). For each drive, create a partition and mark it as a RAID partition.

sudo fdisk /dev/sda

This will open up fdisk, the partition manager. If you already have any partitions on the drive you should first delete them (obviously this will erase any data on them!). To create one partition that is the size of the whole drive:

Command (m for help): n
Command action
	e	extended
	p	primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-182401, default 1): [blank]
Last cylinder or +size or +sizeM or +sizeK (1-182401, default 182401): [blank]

When choosing the first and last cylinder simply hitting return will use the default values (which are probably the values you actually want).

Next we will mark the partition as being part of a RAID array, allowing mdadm to automatically detect it:

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid auto)

So far our changes haven’t actually been written to disk, so finally, issue the command to write the changes to disk.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

Growing

One of the advantages of software RAID is the flexibility it gives you, that would normally only be available from high end (expensive) RAID cards. This includes the ability to grow an existing array (only for certain RAID levels), which means if you run out of space you can easily plug in a new drive and keep going.

1. Growing the array

Growing a RAID-5 array with mdadm is a fairly simple (though slow) task. First you will need to prepare the new drive in the same we we prepared the initial drives (step 1, above). To start the actual growing of the array we then add the new drive to the array as a spare:

sudo mdadm --add /dev/md0 /dev/sdd1

Then we grow the array onto this device. Because I had 3 drives before, the new drive obviously makes 4. Make sure to change this to whatever number you now have!

sudo mdadm --grow /dev/md0 --raid-devices=4

As when creating the array, we can follow the progress by checking the file /proc/mdstat.

sudo watch cat /proc/mdstat

Again, I decided to wait for the operation to finish before attempting to grow the filesystem, but you should be able to do it while the array syncs.

Návod je sice na ubuntu 9, ale na debianu squeeze fungoval bez problémů:

http://www.jamierf.co.uk/2009/11/04/software-raid-5-using-mdadm-in-ubuntu-9-10/

Avatar

By mirra

Hardwaru a počítačům se věnuji již od roku 2003. Za tu dobu jsem poskládal stovky počítačů, opravil tisíce počítačů a vyřešil nespočetně problémů, vad a chyb, se kterými se setkávali uživatelé. Od roku 2005 se zabývám servery, zejména těmi herními, v roce 2007 jsem se začal věnovat Valve Source SDK level designu, který šel od roku 2009 k ledu kvůli studiu Informatiky na univerzitě. Podílel jsem se chvíli i na provozu síťové laboratoře MENDELU, dnes spravuji cca 30 serverů/diskových polí na univerzitě, řeším IT v malých a středních firmách tak, aby firmy ušetřily nemalé částky při zlepšení kvality a soustředím se na snižování nákladů na IT od licencí až po hardware, software, provádím konsolidace a audity platnosti licencí, které firmám šetří rovněž nemalé peníze. Z velkých firem spravuji s dalšími kolegy 8000 serverů po celé Evropě a tato práce mě nesmírně baví, protože se vše musí automatizovat a nabízí mi to možnost trénovat další evropské jazyky od Angličtiny, přes Němčinu až po Italštinu.

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *

five − one =