Welcome to Catalin(ux) M. BOIE's page!
Here you can find some work of mine on Linux kernel & other stuff.

E-mail: catab # embedromix dot ro
Phone: +40-745-048374
RSS feed for this site
My Fedora repository: rpm -Uhv http://kernel.embedromix.ro/dinorepo-0.0.12-1.noarch.rpm
My Oracle/RedHat/CentOS repository: rpm -Uhv http://kernel.embedromix.ro/dinorepo-el-0.0.13-1.noarch.rpm
Supported architectures: x86_64, i386, armv7hl, aarch64.
For commercial support and customizations, contact us at: Embedromix

[Home]  [Networking]  [Crypto]  [Linux kernel patches]  [Userspace]  [Docs]  [CV/Resume]  [Links

Name Description Links
Presentations Presentations made by me present.html
IFB A mini howto on how to shape on incoming packets and distribute packets on multiple interfaces, sharing bandwidth. ifb.html
RAID mini HOWTO A mini howto describing linear, 0, 1, 5 and 6, using mdadm. RAID.html
git mini HOWTO A mini howto describing how to use git. git.html
LVM mini HOWTO A mini howto describing how to use LVM. LVM.html
IPv6 mini howtos Some mini howtos to easy IPv6 implementation. ipv6.html
Random stuff Some usefull one-liners. random.html

Another mini HOWTO for RAID


Content: Linear, RAID0, RAID1, RAID5, RAID6 and a mini Slackware HOWTO
Author: Catalin(ux) M BOIE
URL: http://kernel.embedromix.ro/docs/
Version: 0.3
[Start]
dd if=/dev/zero of=disk1 bs=1M count=20
dd if=/dev/zero of=disk2 bs=1M count=20
dd if=/dev/zero of=disk3 bs=1M count=20
dd if=/dev/zero of=disk4 bs=1M count=20

losetup /dev/loop1 disk1
losetup /dev/loop2 disk2
losetup /dev/loop3 disk3
losetup /dev/loop4 disk4


[liniar]
# info
- Disks are concatenated.
- Data [123456789] is writen like this:
disk1: 123
disk2: 456
disk3: 789

# create array
mdadm --create /dev/md0 --level linear --raid-devices 3 \
	/dev/loop1 /dev/loop2 /dev/loop3

# cat /proc/mdstat 
???

# make filesystem
mkreiserfs -s513 /dev/md0

# df
/dev/md/0                61240      2120     59120   4%

# mdadm -D /dev/md0
        Version : 00.90.01
  Creation Time : Wed Sep 15 13:18:07 2004
     Raid Level : linear
     Array Size : 61248 (59.81 MiB 62.72 MB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Sep 15 13:18:07 2004
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

       Rounding : 64K

    Number   Major   Minor   RaidDevice State
       0       7        1        0      active sync   /dev/loop/1
       1       7        2        1      active sync   /dev/loop/2
       2       7        3        2      active sync   /dev/loop/3
           UUID : 77f48182:97b30d4b:5a182b31:ec9a49a9
         Events : 0.33

# stop array
mdadm --stop /dev/md0


[RAID0]
# info
- Disks are filled in chunks in a round-robin fashion
- Does not survive to 1 disk crash
- Data [123456789] is writen like this:
disk1: 147
disk2: 258
disk3: 369

# create array
mdadm --create /dev/md0 --level 0 --raid-devices 3 \
	/dev/loop1 /dev/loop2 /dev/loop3

# cat /proc/mdstat 
???

# make filesystem
mkreiserfs -s513 /dev/md0

# df
#/dev/md/0                61240      2120     59120   4%

# mdadm -D /dev/md0
        Version : 00.90.01
  Creation Time : Wed Sep 15 12:56:04 2004
     Raid Level : raid0
     Array Size : 61248 (59.81 MiB 62.72 MB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Sep 15 12:56:04 2004
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 64K

    Number   Major   Minor   RaidDevice State
       0       7        1        0      active sync   /dev/loop/1
       1       7        2        1      active sync   /dev/loop/2
       2       7        3        2      active sync   /dev/loop/3
           UUID : 365be1f3:b1b1a51e:cb67e153:6ebe221e
         Events : 0.22

# stop array
mdadm --stop /dev/md0


[RAID1]
# info
- Survives to n-1 disk crashes
- Also known as mirroring

# create array
mdadm --create /dev/md0 --level 1 --raid-devices 3 \
	/dev/loop1 /dev/loop2 /dev/loop3

# cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [raid5] [raid6] 
md0 : active raid1 loop3[2] loop2[1] loop1[0]
      20416 blocks [3/3] [UUU]
      
unused devices: 

# make filesystem
mkreiserfs -s513 /dev/md0

# df
#/dev/md/0                20408      2120     18288  11%

# mdadm -D /dev/md0
        Version : 00.90.01
  Creation Time : Wed Sep 15 13:45:15 2004
     Raid Level : raid1
     Array Size : 20416 (19.94 MiB 20.91 MB)
    Device Size : 20416 (19.94 MiB 20.91 MB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Sep 15 13:46:01 2004
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0


    Number   Major   Minor   RaidDevice State
       0       7        1        0      active sync   /dev/loop/1
       1       7        2        1      active sync   /dev/loop/2
       2       7        3        2      active sync   /dev/loop/3
           UUID : 6f439ee6:b997776d:e12ef07a:462cce63
         Events : 0.51

# stop array
mdadm --stop /dev/md0


[RAID5]
# info
- Survives to 1 disk crash

# create array
mdadm --create /dev/md0 --chunk 64 --level 5 --raid-devices 3 \
	/dev/loop1 /dev/loop2 /dev/loop3

# cat /proc/mdstat 
???

# make filesystem
mkreiserfs -s513 /dev/md0

# df
#/dev/md/0                40824      2120     38704   6%

# mdadm -D /dev/md0
        Version : 00.90.01
  Creation Time : Wed Sep 15 13:11:41 2004
     Raid Level : raid5
     Array Size : 40832 (39.88 MiB 41.81 MB)
    Device Size : 20416 (19.94 MiB 20.91 MB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Sep 15 13:12:16 2004
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

    Number   Major   Minor   RaidDevice State
       0       7        1        0      active sync   /dev/loop/1
       1       7        2        1      active sync   /dev/loop/2
       2       7        3        2      active sync   /dev/loop/3
           UUID : ee31370a:10c2b48f:275711db:3d578e0a
         Events : 0.30


# stop array
mdadm --stop /dev/md0


[RAID6]
# info
- Minimum 4 disks
- Survives to 2 disk crash.

# create array
mdadm --create /dev/md0 --level 6 --raid-devices 4 \
	/dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4

# cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [raid5] [raid6] 
md0 : active raid6 loop4[3] loop3[2] loop2[1] loop1[0]
      40832 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
      
unused devices: 

# make filesystem
mkreiserfs -s513 /dev/md0

# df
#/dev/md/0                40824      2120     38704   6%

# mdadm -D /dev/md0
        Version : 00.90.01
  Creation Time : Wed Sep 15 13:36:40 2004
     Raid Level : raid6
     Array Size : 40832 (39.88 MiB 41.81 MB)
    Device Size : 20416 (19.94 MiB 20.91 MB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Sep 15 13:38:26 2004
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0


    Number   Major   Minor   RaidDevice State
       0       7        1        0      active sync   /dev/loop/1
       1       7        2        1      active sync   /dev/loop/2
       2       7        3        2      active sync   /dev/loop/3
       3       7        4        3      active sync   /dev/loop/4
           UUID : 9cd6d756:b26c94ea:b0959dec:e2f0cb9b
         Events : 0.41

# stop array
mdadm --stop /dev/md0





**************************
I have installed slack on a disk.
How do I convert to RAID1?

0. Before starting
	SLACK installed on /dev/hda (hda1), /dev/hdc is empty
	Kernel compiled with support for RAID1 and your
	favourite fs built-in.

1a. Change partition type for hda1 to 0xfd (RAID autodetect) using cfdisk.

1b. Partition the second disk the same way as the first one.
	WARNING: CHECK NEXT LINE 10 TIMES BEFORE RUNNING IT!
	sfdisk -d /dev/hda | sfdisk /dev/hdc

2. Create array with the second (empty) disk in degraded mode:
	mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/hdc1 missing
	cat /proc/mdstat:
	Personalities : [linear] [raid0] [raid1] [raid5] [raid6] 
	md0 : active raid1 hdc1[0]
	      20416 blocks [2/1] [U_]
	      
	unused devices: 

3. mkreiserfs /dev/md0 (or any fs you want)

4. mkdir /Z; mount /dev/md0 /Z

5. mkdir /Z/proc /Z/sys

6. cp -a /bin /boot /dev /etc /lib /mnt /opt /root /sbin /tmp \
	/usr /var /Z
	You may want to save other things like /data etc.

7. fstab & lilo.conf
	Edit /Z/etc/fstab and replace /dev/hda1 with /dev/md0.
	Edit /Z/etc/lilo.conf and replace root = /dev/hda1 with
	root = /dev/md0. Then run lilo -r /Z

8. Reboot.
	Check if you are using the new root filesystem (md0).

9. Second disk to RAID1
	BACKUP ALL REMAINING DATA ON /dev/hda1 BEFORE THIS STEP.
	/dev/hda1 disk is not used anymore, so hot add it to the aray:
	mdadm -a /dev/md0 /dev/hda1
	cat /proc/mdstat 
	Personalities : [linear] [raid0] [raid1] [raid5] [raid6] 
	md0 : active raid1 hdc1[2] hda1[0]
	      20416 blocks [2/1] [U_]
	      [====>................]  recovery = 20.0% (4224/20416) finish=0.1min speed=1408K/sec
	unused devices: 

10. Now you have a working RAID1 system.