LVM Notes
I wanted to upgrade the disks in my Linux PVR to a 1TB pair and thus had to migrate from one existing disk (/dev/sda) to the new (/dev/sdb):
1. Add new physical disk to system
2. Partition disk to have a linux LVM partition – use flag 0×8e
# fdisk /dev/sdb
3. Add to LVM
# pvcreate /dev/sdb2
4. Add physical LVM volume to a LVM volume group (VolGroup00)
# vgextend /dev/VolGroup00 /dev/sdb2
2. Move all lvm volumes off old lvm disk
# vgdisplay -v (look for old physical volume name)
# pvmove /dev/olddisk # will move all physical extents from olddisk to any available pv in the vg
3. Remove old disk from vg
# vgreduce /dev/olddisk
4. Remove old disk from LVM
# pvremove /dev/olddisk
RAID Notes
Debian RAID setup on my PVR:
/dev/md0 /boot
/dev/hda1
/dev/hdb1
/dev/md1 /
/dev/hda2
/dev/hdb2
/dev/md2 swap
/dev/hda3
/dev/hdb3
/dev/md3 /data
/dev/hda4
/dev/hdb4
Show detail of RAID set:
# mdadm –detail /dev/md0
Detach mirror member:
- first mark member as bad (unless is really is bad, in which case it’ll already be marked faulty):
# mdadm –set-faulty /dev/md0 /dev/hdb1
- now remove it from the RAID1 set
# mdadm –remove /dev/md0 /dev/hdb1
To reattach member (after partitioning, or if it’s the same disk):
# mdadm /dev/md0 –add /dev/hdb1
- to watch the progress on the resync, look at /proc/mdstat
# cat /proc/mdstat
I think now (2010/01/24) the faulty syntax is:
mdadm /dev/md0 –fail /dev/sdb1
then
mdadm /dev/md0 –remove /dev/sdb1