Pokazywanie postów oznaczonych etykietą lvm2. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą lvm2. Pokaż wszystkie posty

wtorek, 29 kwietnia 2014

LVM2 - reduce

1. Unmount
Użyj innej dystrybucji np. systemrecoverycd.iso

2. df -h

3. sprawdź dysk
e2fsck -f /dev/yourVG/yourLV 

4. z flagą -r --resizefs
       Resize underlying filesystem together with the logical volume using fsadm


...zmniejszenie o 50GB
lvreduce -r -L -50G /dev/yourVG/yourLV

... zmniejszenie do wielkości 150GB
lvreduce -r -L 150G /dev/yourVG/yourLV

5. Odłączenie dysku z LVM2

... w zkrócie ...
a) pvs
wyświetli wolne dyski
... ewentualnie przenieś dane na inny dysk

b)pvmove /dev/sdb1

c) usuń z VG
vgreduce myvg /dev/sdb1

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Cluster_Logical_Volume_Manager/disk_remove_ex.html



5.4. Removing a Disk from a Logical Volume


This example shows how you can remove a disk from an existing logical volume, either to replace the disk or to use the disk as part of a different volume. In order to remove a disk, you must first move the extents on the LVM physical volume to a different disk or set of disks.

5.4.1. Moving Extents to Existing Physical Volumes

In this example, the logical volume is distributed across four physical volumes in the volume group myvg.
[root@tng3-1]# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
We want to move the extents off of /dev/sdb1 so that we can remove it from the volume group.
If there are enough free extents on the other physical volumes in the volume group, you can execute the pvmove command on the device you want to remove with no other options and the extents will be distributed to the other devices.
[root@tng3-1 ~]# pvmove /dev/sdb1
  /dev/sdb1: Moved: 2.0%
 ...
  /dev/sdb1: Moved: 79.2%
 ...
  /dev/sdb1: Moved: 100.0%
After the pvmove command has finished executing, the distribution of extents is as follows:
[root@tng3-1]# pvs -o+pv_used
  PV         VG   Fmt  Attr PSize  PFree  Used
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G 10.00G
  /dev/sdb1  myvg lvm2 a-   17.15G 17.15G     0
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G  5.00G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G 15.00G
Use the vgreduce command to remove the physical volume /dev/sdb1 from the volume group.
[root@tng3-1 ~]# vgreduce myvg /dev/sdb1
  Removed "/dev/sdb1" from volume group "myvg"
[root@tng3-1 ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda1  myvg lvm2 a-   17.15G  7.15G
  /dev/sdb1       lvm2 --   17.15G 17.15G
  /dev/sdc1  myvg lvm2 a-   17.15G 12.15G
  /dev/sdd1  myvg lvm2 a-   17.15G  2.15G
The disk can now be physically removed or allocated to other users.

czwartek, 13 lutego 2014

LVM - manage

http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/

W skrócie

Nowy dysk
fdisk /dev/sdq
n
p
1
t 8e
w
-
pvcreate /dev/sdq1

vgdisplay
vgextend vgpool /dev/sdq1

lvextend -L+10G /dev/lvpool/root      ....  plus 10GB
lvextend -l +100%FREE /dev/lvpool/root   ..... cale wolne miejsce
resize2fs /dev/lvpool/root


In our previous article we told you what LVM is and what you may want to use it for, and today we are going to walk you through some of the key management tools of LVM so you will be confident when setting up or expanding your installation.
As stated before, LVM is a abstraction layer between your operating system and physical hard drives. What that means is your physical hard drives and partitions are no longer tied to the hard drives and partitions they reside on. Rather, the hard drives and partitions that your operating system sees can be any number of separate hard drives pooled together or in a software RAID.
To manage LVM there are GUI tools available but to really understand what is happening with your LVM configuration it is probably best to know what the command line tools are. This will be especially useful if you are managing LVM on a server or distribution that does not offer GUI tools.
Most of the commands in LVM are very similar to each other. Each valid command is preceded by one of the following:
  • Physical Volume = pv
  • Volume Group = vg
  • Logical Volume = lv

środa, 6 czerwca 2012

LVM2: vgscan fails to recreate lvmtab

LINK

I recently moved an LVM array from one server to another. When I tried to recreate the lvmtab with pvscan/vgscan, it successfully found my 3 disks, but do not recreate lvm tab.

# pvscan -v
Wiping cache of LVM-capable devices
Wiping internal VG cache
Walking through all physical volumes
PV /dev/sdb1 VG vg0 lvm2 [4.00 GiB / 0 free]
PV /dev/sdc1 VG vg0 lvm2 [4.00 GiB / 0 free]
PV /dev/sdd1 VG vg0 lvm2 [4.00 GiB / 0 free]
Total: 3 [11.99 GiB] / in use: 3 [11.99 GiB] / in no VG: 0 [0 ]


# vgscan -v
Wiping cache of LVM-capable devices
Wiping internal VG cache
Reading all physical volumes. This may take a while...
Finding all volume groups
Finding volume group "vg0"
Found volume group "vg0" using metadata type lvm2


# lvscan -v
Finding all logical volumes
inactive '/dev/vg0/opt' [11.99 GiB] inherit

At the end, I have no /dev/vg0 and no /etc/lvmtab.

Any ideas?

lvchange -ay /dev/vg0/opt
The volume is not activeated, with this command you actually activate it.

Ginekolog dr n. med. Piotr Siwek

Gabinet ginekologiczny specjalista ginekolog - położnik dr n. med. Piotr Siwek