Unit 8 Block Devices, Raid, and LVM: Welcome To
Unit 8 Block Devices, Raid, and LVM: Welcome To
Unit 8
Block Devices,
RAID, and LVM
block
1 2 3 4 5 6 7 8
0 512 4096
byte
# fdformat -n /dev/fd0h1440
Double-sided, 80 tracks, 18 sec/track. Total
capacity 1440 kB.
Formatting ... done
Verifying ... done
PE PE PE PE PE PE
PE PE PE PE PE PE
PE PE PE PE PE PE
logical volume
volume group
© Copyright IBM Corporation 2006
LVM Implementation Overview
• Add hard disks and/or create partitions (type 0x8e) on
existing hard disks
• Initialize physical volumes (disks or partitions)
# pvcreate /dev/hda3
# pvcreate /dev/hdb
• vgdisplay [<vg>]
– Display information about a volume group
• vgremove <vg>
– Delete a volume group
PE PE PE PE PE PE
PE PE PE PE PE PE
PE PE PE PE PE PE
volume group
/dev/vg00/mystripedlv
© Copyright IBM Corporation 2006
Extending/Reducing a Volume Group
• To add or remove a Physical Volume to or from a Volume
Group, use the vgextend and vgreduce commands
• To move Physical Extents from one Physical Volume to
another use pvmove
1. vgcfgbackup
2. vgcfgrestore -n vg_name PV
VGDA VGDA VGDA
/etc/lvmconf/vg_name.conf
1 6 1 2 1 1
2 7 3 4 2 2
3 8 5 6 3 3
4 9 7 8 4 4
5 10 9 10 5 5
1 2 p 1 2 p
3 4 p 3 p 4
5 6 p p 5 6
7 8 p 7 8 p
9 10 p 9 p 10
0 2 Fast Fast No 3 GB
(*) Performance compared to a single disk, for data transfers greater than block size
© Copyright IBM Corporation 2006
Linux RAID Support
• Software RAID
– Implemented in Linux kernel
– Needs raidtools package
– Uses disk partitions to create RAID devices
– Logical device name: /dev/mdn
• Hardware RAID
– Implemented in special adapter cards
– Adapter needs to be supported by Linux kernel
– Generally specific software needed to configure adapter
correctly (might not be available under Linux)
– RAID devices show up as regular SCSI disk
# mkraid /dev/md0
# mkfs /dev/md0
...
# mount /dev/md0 /mnt/raid0
# cat /proc/mdstat
Personalities:[linear] [raid5]
read_ahead 1024 sectors
md0: active raid5 sdc1[2] sdb1[1] sdd1[3] sde1[0]
633849 blocks level 5, 32k chunk, algorithm 2 [4/4] [UUUU]
unused devices: <none>
spare disk