http://tldp.org/HOWTO/LVM-HOWTO/recipethreescsistripe.html
sudo pvcreate /dev/md0 sudo pvcreate /dev/md1
sudo vgcreate "my_group" /dev/md0 /dev/md1
sudo vgdisplay --units m
sudo lvcreate --size 8G --stripes 2 --stripesize 4 --name "root" "my_group" sudo lvcreate --size 4G --stripes 2 --stripesize 4 --name "swap" "my_group" sudo lvcreate --size 941584M --stripes 2 --stripesize 4 --name "datastore" "my_group"
vgrename
, lvrename
)fstab
-ban és a grub
-banpvcreate "/dev/sdd1"
vgextend "my_group" "/dev/sdd1"
lvs -a -o +devices
pvmove "/dev/md0"
vagy adjuk meg konkrétan azt is, hogy hova:
pvmove "/dev/md0" "/dev/sdd1"
vgreduce "my_group" "/dev/md0"
pvremove "/dev/md0"
lvextend -l +100%FREE "/dev/my_group/private"
lvextend -L +100G "/dev/my_group/private"
fsck.ext4 -f "/dev/my_group/private" resize2fs -p "/dev/my_group/private" fsck.ext4 -f "/dev/my_group/private"
Mounting is an easy process to do, provided the filesystem type you are using is supported. What happen when you have an LVM formatted disk, and you need to mount it because the disk cannot be booted and a hell lot of valuable data kept inside?? Do not worry, because the solution is here…….
Get a live cd, for example, Ubuntu. For this article, I use Ubuntu 6.06 (I cannot find any latest version of ubuntu at my place) Boot using the live cd. Search for these tools: lvm2. If the cd do not have it, install it.sudo apt-get install lvm2 To make sure the harddisk is recognised, you can use fdisksudo fdisk -lu Once installed, run pvscan to scan all disks for physical volume. this to make sure your LVM harddisk is detected by Ubuntusudo pvscan #PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free] #Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ] After that run vgscan to scan disks for volume groups.sudo vgscan #Reading all physical volumes. This may take a while... #Found volume group "VolGroup00" using metadata type lvm2 Activate all volume groups available.sudo vgchange -a y #2 logical volume(s) in volume group "VolGroup00" now active Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.sudo lvscan #ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit #ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit Mount the partition to any directory you want, usually to /mntsudo mount /dev/VolGroup00/LogVol00 /mnt
sudo vgcfgbackup -f vgbackup.cfg
#!/bin/sh ### BEGIN INIT INFO # Provides: lvm2 lvm # Required-Start: mountdevsubfs # Required-Stop: # Should-Start: udev mdadm-raid cryptdisks-early multipath-tools-boot # Should-Stop: umountroot mdadm-raid # X-Start-Before: checkfs mountall # X-Stop-After: umountfs # Default-Start: S # Default-Stop: ### END INIT INFO SCRIPTNAME=/etc/init.d/lvm2 . /lib/lsb/init-functions [ -x /sbin/vgchange ] || exit 0 do_start() { modprobe dm-mod 2> /dev/null || : export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 /sbin/vgscan --ignorelockingfailure || : /sbin/vgchange -aly --ignorelockingfailure || return 2 } do_stop() { /sbin/vgchange -an || return 2 } case "$1" in start) log_begin_msg "Setting up LVM Volume Groups" do_start case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) do_stop ;; restart|force-reload|status) ;; *) echo "Usage: $SCRIPTNAME start" >&2 exit 3 ;; esac
--- /usr/share/initramfs-tools/scripts/local-top/lvm2 2009-08-17 19:28:09.000000000 +0200 +++ /usr/share/initramfs-tools/scripts/local-top/lvm2 2010-02-19 23:22:14.000000000 +0100 @@ -45,12 +45,30 @@ eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev") - if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ]; then - lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME" - rc=$? - if [ $rc = 5 ]; then - echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME" - fi + # Make sure that we have non-empty volume group and logical volume + if [ -z "$DM_VG_NAME" ] || [ -z "$DM_LV_NAME" ]; then + return 1 + fi + + # If the logical volume hasn't shown up yet, give it a little while + # to deal with LVM on removable devices (inspired from scripts/local) + fulldev="/dev/$DM_VG_NAME/$DM_LV_NAME" + if [ -z "`lvm lvscan -a --ignorelockingfailure |grep $fulldev`" ]; then + # Use default root delay + slumber=$(( ${ROOTDELAY:-180} * 10 )) + + while [ -z "`lvm lvscan -a --ignorelockingfailure |grep $fulldev`" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + [ ${slumber} -gt 0 ] || break + done + fi + + # Activate logical volume + lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME" + rc=$? + if [ $rc = 5 ]; then + echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME" fi }
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=lvm2_wait-lvm.patch;att=1;bug=568838
dmsetup ls
dmsetup remove xxx