Extending a VG and LV LINUX release 6.0
[root@linux5 scsi_host]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@linux5 scsi_host]#
I am trying to raise the size of root filesystem Online. Steps I did were as below.
1. After assigning the disk to LINU Machine, you need to run "fdisk -l", if still the disk is not visible after being assigned, please run below command.
#echo "- - -" >> /sys/class/scsi_host/host0 or host1 or host2 or so.
[root@linux5 scsi_disk]# cd ../scsi_host/
[root@linux5 scsi_host]# ls -ltr
total 0
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host3 -> ../../devices/pci0000:00/0000:00:0d.0/host3/scsi_host/host3
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host2 -> ../../devices/pci0000:00/0000:00:0d.0/host2/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host1 -> ../../devices/pci0000:00/0000:00:01.1/host1/scsi_host/host1
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host0 -> ../../devices/pci0000:00/0000:00:01.1/host0/scsi_host/host0
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]# uname -a
Linux linux5 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@linux5 scsi_host]# pwd
/sys/class/scsi_host
[root@linux5 scsi_host]#
then disk will be visible.
1. the o/p of "vgdisplay" without assigning new disk to LINUX Machine.
[root@linux5 /]#
[root@linux5 /]# vgdisplay
--- Volume group ---
VG Name vg_linux5
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 11.50 GiB
PE Size 4.00 MiB
Total PE 2945
Alloc PE / Size 898 / 3.51 GiB
Free PE / Size 2047 / 8.00 GiB
VG UUID 1kibLc-6d5o-MNlv-Vmfc-l96i-z6fP-oHLMv2
[root@linux5 /]#
[root@linux5 /]#
after detection of newly assigned disk to LINUX MACHINE with "FDISK -L", like on my machine it was detected as /dev/sdb
I did following steps to extend VG.
# pvcreate /dev/sdb
# vgextend vg_linux5 /dev/sdb ##### vg_linux5 is my VG name built for root file system.
# lvextend -L +2G /dev/mapper/vg_linux5-lv_root.
o/p shown below :-
[root@linux5 /]# vgdisplay
--- Volume group ---
VG Name vg_linux5
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 11.50 GiB
PE Size 4.00 MiB
Total PE 2945
Alloc PE / Size 898 / 3.51 GiB
Free PE / Size 2047 / 8.00 GiB
VG UUID 1kibLc-6d5o-MNlv-Vmfc-l96i-z6fP-oHLMv2
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
1.8G 1.2G 536M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]# pwd
/
[root@linux5 /]#
[root@linux5 /]# lvextend -L +2G /dev/mapper/vg_linux5-lv_root
Extending logical volume lv_root to 3.77 GiB
Logical volume lv_root successfully resized
[root@linux5 /]#
After you need to resize your file system or LV, because Change will not appear. as below.
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
1.8G 1.2G 536M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
[root@linux5 /]#
Now run resize2fs on LV, it will change the size and display the output in df -h command and then we can use the LV for your purpose.
[root@linux5 /]# resize2fs /dev/mapper/vg_linux5-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_linux5-lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/vg_linux5-lv_root to 988160 (4k) blocks.
The filesystem on /dev/mapper/vg_linux5-lv_root is now 988160 blocks long.
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
3.8G 1.2G 2.4G 33% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
suggestions and other methods are most welcome.
[root@linux5 scsi_host]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@linux5 scsi_host]#
I am trying to raise the size of root filesystem Online. Steps I did were as below.
1. After assigning the disk to LINU Machine, you need to run "fdisk -l", if still the disk is not visible after being assigned, please run below command.
#echo "- - -" >> /sys/class/scsi_host/host0 or host1 or host2 or so.
[root@linux5 scsi_disk]# cd ../scsi_host/
[root@linux5 scsi_host]# ls -ltr
total 0
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host3 -> ../../devices/pci0000:00/0000:00:0d.0/host3/scsi_host/host3
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host2 -> ../../devices/pci0000:00/0000:00:0d.0/host2/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host1 -> ../../devices/pci0000:00/0000:00:01.1/host1/scsi_host/host1
lrwxrwxrwx. 1 root root 0 Sep 22 13:22 host0 -> ../../devices/pci0000:00/0000:00:01.1/host0/scsi_host/host0
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]#
[root@linux5 scsi_host]# uname -a
Linux linux5 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@linux5 scsi_host]# pwd
/sys/class/scsi_host
[root@linux5 scsi_host]#
then disk will be visible.
1. the o/p of "vgdisplay" without assigning new disk to LINUX Machine.
[root@linux5 /]#
[root@linux5 /]# vgdisplay
--- Volume group ---
VG Name vg_linux5
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 11.50 GiB
PE Size 4.00 MiB
Total PE 2945
Alloc PE / Size 898 / 3.51 GiB
Free PE / Size 2047 / 8.00 GiB
VG UUID 1kibLc-6d5o-MNlv-Vmfc-l96i-z6fP-oHLMv2
[root@linux5 /]#
[root@linux5 /]#
after detection of newly assigned disk to LINUX MACHINE with "FDISK -L", like on my machine it was detected as /dev/sdb
I did following steps to extend VG.
# pvcreate /dev/sdb
# vgextend vg_linux5 /dev/sdb ##### vg_linux5 is my VG name built for root file system.
# lvextend -L +2G /dev/mapper/vg_linux5-lv_root.
o/p shown below :-
[root@linux5 /]# vgdisplay
--- Volume group ---
VG Name vg_linux5
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 11.50 GiB
PE Size 4.00 MiB
Total PE 2945
Alloc PE / Size 898 / 3.51 GiB
Free PE / Size 2047 / 8.00 GiB
VG UUID 1kibLc-6d5o-MNlv-Vmfc-l96i-z6fP-oHLMv2
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
1.8G 1.2G 536M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
[root@linux5 /]#
[root@linux5 /]# pwd
/
[root@linux5 /]#
[root@linux5 /]# lvextend -L +2G /dev/mapper/vg_linux5-lv_root
Extending logical volume lv_root to 3.77 GiB
Logical volume lv_root successfully resized
[root@linux5 /]#
After you need to resize your file system or LV, because Change will not appear. as below.
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
1.8G 1.2G 536M 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
[root@linux5 /]#
Now run resize2fs on LV, it will change the size and display the output in df -h command and then we can use the LV for your purpose.
[root@linux5 /]# resize2fs /dev/mapper/vg_linux5-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_linux5-lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/vg_linux5-lv_root to 988160 (4k) blocks.
The filesystem on /dev/mapper/vg_linux5-lv_root is now 988160 blocks long.
[root@linux5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linux5-lv_root
3.8G 1.2G 2.4G 33% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 194M 25M 159M 14% /boot
[root@linux5 /]#
suggestions and other methods are most welcome.
No comments:
Post a Comment