TERMINOLOGY:
- Partition - a portion of physical hard disk space. A hard disk may contain one or more partitions. Partitions are defined by BIOS and described by partition tables stored on a harddrive.
- Volume - a logical concept which hides the physical organization of storage space. A compatibility volume directly corresponds to a partition while LVM volume may span more than one partition on one or more physical disks. A volume is seen by users as a single drive letter.
- Physical Volume (PV) Synonym for “hard disk”. A single physical hard drive.
- Volume Group (VG) A set of one or more PVs which form a single storage pool. You can define multiple VGs on each system.
- Logical Volume (LV) A usable unit of disk space within VG. LVs are used analogously to partitions on PCs or slices under Solaris: they usually contain filesystems or paging spaces (“swap”)Unlike physical partition can span multiple physical volumes that constitute VG. .
- Root partition. Physical or logical partition what holds root filesystem and mount points for all other partitions. Can be physical partition or logical volume.
LVM Commands
- pvcreate /dev/hda3 – creates physical volumes
- vgcreate vg01 /dev/hda3 – creates a volume group (in this case, vg01) using the physical volume
- lvcreate -l25000 -nlv01 vg01 – creates a logical volume using the volume group, allocating 25000 blocks
- lvcreate -L4G -nlvroot vgraid1
- vgextend – adds a volume to the volume group (if you add a new disk)
- lvdisplay -v /dev/vg01/lv01
- vgdisplay -v vg01
- lvremove
- vgreduce
- mkfs -t ext3 /dev/vg01/lv02 makes a file system
- mount /dev/vg01/lv02 /home/new mount the file system
- mount -a mounts everything in /etc/fstab
- vgscan –mknodes
- vgchange -a y /dev/vgraid1 (bring /dev/vgraid1 online if it didn’t come up automatically)
- lvscan
- mkfs -t ext4 -t small /dev/vgraid5extra
- umount /home/new (unmount a filesystem)
- pvresize – update size of pv
- lvextend -L+ /dev/vgraid0/lvsharedfiles0
- e2fsck -f /dev/vgraid1/lvsharedfilestemp (check filesystem)
- resize2fs /dev/vgraid1/lvsharedfilestemp (resize the filesystem) (now works online)
MDADM stuff
RAID
raidtools2
mdadm (probably a better choice)
/etc/raid/raidtab
http://unthought.net/Software-RAID.HOWTO/
http://xtronics.com/reference
http://juerd.nl/site.plp/debianraid
mdadm -Cv /dev/md0 -l1 -n2 missing /dev/sda1 –auto creates a degraded raid 1 array
mdadm -Cv -c 256 /dev/md20 -l5 -n2 missing /dev/sdf1 array with chunk size
mdadm -A -a /dev/md0 /dev/sda1
mdadm -A -a /dev/md1 /dev/sda2
fixing a degraded array
mdadm –add /dev/md7 /dev/sdd2
mkfs -t ext3 /dev/md20 – make a file system
mkfs -t ext3 -T largefile4 -E stride=16,stripe-width=2 /dev/md20 – reduce inodes, runs faster on big files
largefile4 is defined in /etc/mke2fs.conf, blocksize defaults to 4096, so with chunk size of 256, we need stride of 16
mdadm –detail –scan >> /etc/mdadm/mdadm.conf