Sunteți pe pagina 1din 1

Linux Workshop

Lab 12 Partitioning, Software RAID


Requirements Quick Reference Objectives to learn
➢ A running Linux machine with extra disks or free Partitioning #Three example tools (as root):
fdisk -l #List disks and partitions
space for partitions. Linux can create RAID sets fdisk /dev/hda #Partition master disk on primary channel
using partitions on one disk. This is not very parted /dev/hdb #Partition slave disk on primary channel
cfdisk /dev/sda #Partition first serial disk
secure, but the exercise is helpful. df -h #Show disk free space (-human readable)
➢ If no free partition space is available, then the du -h #Show disk usage (-human readable)
losetup command can create virtual partitions
(See Quick Reference at the right) 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.:
To Do mke2fs -j -b 4096 -R stride=8 /dev/md1
mount /dev/md1 /data #Change /etc/fstab for surviving the reboot
1. If you are using VMware: Add 5 disks of 4GB to lsraid -A -a /dev/md1 #Check raidset
cat /proc/mdstat #Check raidset
the virtual machine. Use partitions of maximal raidsetfaulty /dev/md1 /dev/sdc1 #Test raidset
100MB on every disk in the next exercise. This raidhotremove /dev/md1 /dev/sdc1 #Remove faulty disk from raidset
raidhotadd /dev/md1 /dev/sdc1 #Regenerate raidset
will prevent the host of disk flooding. raidadd -a ... #Regenerate raidset after break down
2. Create a RAID 1 and 5 set for /data and check #The mdadm Software RAID package does not use /etc/raidtab
the status. Use a spare on the RAID 1 and 5 set. dd if=/dev/zero of=disk1.img bs=10M count=5
dd if=/dev/zero of=disk2.img bs=10M count=5
3. Break the set by removing a disk or using the losetup /dev/loop1 disk1.img #Use file1 as a 'disk'
losetup /dev/loop2 disk2.img #Use file2 as a 'disk'
raidsetfaulty command. Check the status, e.g.: mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/loop1 \
/dev/loop2
lsraid -A -a /dev/md1 cat /proc/mdstat #Monitor disk status, and fdisk -l
mkreiserfs /dev/md0 #Format 'disk'
cat /proc/mdstat mount /dev/md0 /local #Use 'disk'
watch cat /proc/mdstat #Show continuous RAID statistics
When raidtools are used instead of mdadm: mdadm --manage --set-faulty /dev/md0 /dev/loop2
mdadm /dev/md0 -r /dev/loop2 #Remove 'disk'
You may remove the faulty disk with e.g.: mdadm /dev/md0 -a /dev/loop2 #Hot add 'disk'
raidhotremove /dev/md1 /dev/sdc1 mdadm --stop /dev/md0 #Stop mirroring

You may regenerate the RAID set with e.g.: Swap partition
fdisk /dev/sdc #Create swap partition (82)
raidhotadd /dev/md1 /dev/sdc1 mkswap /dev/sdc2 #Format swap partition
swapon /dev/sdc2 #Enable swapping
4. Presume you have added memory to your vi /etc/fstab #Add swap mount
cat /proc/swaps #Check swap status
server. You need to extend the swap space for
better performance. Extend the swap space with
512MB. 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

S-ar putea să vă placă și