Linux Workshop
Lab 12 Partitioning, Software RAID Requirements
Quick Reference Objectives to learn
➢ A running Linux machine with extra disks or free
Partitioning fdisk -l fdisk /dev/hda parted /dev/hdb cfdisk /dev/sda df -h du -h
space for partitions. Linux can create RAID sets using partitions on one disk. This is not very secure, but the exercise is helpful. ➢ If no free partition space is available, then the losetup command can create virtual partitions (See Quick Reference at the right)
To Do 1. If you are using VMware: Add 5 disks of 4GB to the virtual machine. Use partitions of maximal 100MB on every disk in the next exercise. This will prevent the host of disk flooding. 2. Create a RAID 1 and 5 set for /data and check the status. Use a spare on the RAID 1 and 5 set. 3. Break the set by removing a disk or using the raidsetfaulty command. Check the status, e.g.: lsraid -A -a /dev/md1 cat /proc/mdstat When raidtools are used instead of mdadm: You may remove the faulty disk with e.g.: raidhotremove /dev/md1 /dev/sdc1 You may regenerate the RAID set with e.g.: raidhotadd /dev/md1 /dev/sdc1 4. Presume you have added memory to your server. You need to extend the swap space for better performance. Extend the swap space with 512MB.
#Three example tools (as root): #List disks and partitions #Partition master disk on primary channel #Partition slave disk on primary channel #Partition first serial disk #Show disk free space (-human readable) #Show disk usage (-human readable)
RAID #Software RAID (fd), raidtools package: fdisk /dev/sdc #Create partition type 'fd', e.g. sdc1 fdisk /dev/sdd #Create partition type 'fd', e.g. sdd1 vi /etc/raidtab #Design /dev/md1; Copy from: man raidtab persistent-superblock 1 #For raid-level 0, 1 & 5 mkraid /dev/md1 #Create /dev/md1; Does a raidstart -a (raidstop /dev/md1 #Aft changing raidtab and before mkraid) mkfs.reiserfs /dev/md1 #Format disk set, or e.g.: mke2fs -j -b 4096 -R stride=8 /dev/md1 mount /dev/md1 /data #Change /etc/fstab for surviving the reboot lsraid -A -a /dev/md1 #Check raidset cat /proc/mdstat #Check raidset raidsetfaulty /dev/md1 /dev/sdc1 #Test raidset raidhotremove /dev/md1 /dev/sdc1 #Remove faulty disk from raidset raidhotadd /dev/md1 /dev/sdc1 #Regenerate raidset raidadd -a ... #Regenerate raidset after break down #The mdadm Software RAID package does not use /etc/raidtab dd if=/dev/zero of=disk1.img bs=10M count=5 dd if=/dev/zero of=disk2.img bs=10M count=5 losetup /dev/loop1 disk1.img #Use file1 as a 'disk' losetup /dev/loop2 disk2.img #Use file2 as a 'disk' mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/loop1 \ /dev/loop2 cat /proc/mdstat #Monitor disk status, and fdisk -l mkreiserfs /dev/md0 #Format 'disk' mount /dev/md0 /local #Use 'disk' watch cat /proc/mdstat #Show continuous RAID statistics mdadm --manage --set-faulty /dev/md0 /dev/loop2 mdadm /dev/md0 -r /dev/loop2 #Remove 'disk' mdadm /dev/md0 -a /dev/loop2 #Hot add 'disk' mdadm --stop /dev/md0 #Stop mirroring Swap partition fdisk /dev/sdc mkswap /dev/sdc2 swapon /dev/sdc2 vi /etc/fstab cat /proc/swaps
#Create swap partition (82) #Format swap partition #Enable swapping #Add swap mount #Check swap status
Theory Modules LPIC 1 Certification Bible, isbn 0-7645-4772-0 ➢ p. 21-27 Partitioning schemes Downloadable manual(www.novell.com/documentation) SUSE LINUX Enterprise Server – Install. and Admin. ➢ p. 22-29 Expert Partitioning with YaST ➢ p. 145-148 Soft RAID
Extra References ➢ www.tldp.org ➢ Software RAID 10 on Linux using mdadm:
www.heronforge.net/redhat/node14.html
© July 7, 2006, wiki.novell.com/index.php/Roberts_Quick_References, author of Foundations of Linux networking