Resize Linux storage with LVM
Jumat, 27 Januari 2012
0
komentar
You need more space on your server/desktop/etc.. This guide will help you add it to the volume you’re currently using on your system. For the sake of making this an easy-to-follow guide, we’ll assume that you already have the new drive showing in your Linux installation from fdisk, but it’s not yet usable (ie: you made it available from shared storage, you installed a new harddrive, etc..).
First, let’s see if the system can see the new storage:
First things first, create a partition on the drive using fdisk, cfdisk, etc.. toggle it type ’8e’.
Next, create the physical volume on the new partition on the new drive:
Volume Group: test_vg
Logical Volume: test_lv
Now, use vgextend to add your new drive to the existing volume group:
First, let’s see if the system can see the new storage:
# fdisk -lNote: you’ll also see information about your current drives..
Disk /dev/sdc doesn't contain a valid partition table
First things first, create a partition on the drive using fdisk, cfdisk, etc.. toggle it type ’8e’.
# fdisk /dev/sdc
Now it should show up a little better in the fdisk -l command.Next, create the physical volume on the new partition on the new drive:
# pvcreate /dev/sdc1Now, find out the volume group and logical volume names on your system. Make note of these..
Physical volume "/dev/sdc1" successfully created
# vgdisplayWe’ll assume that the information is:
# lvdisplay
Volume Group: test_vg
Logical Volume: test_lv
Now, use vgextend to add your new drive to the existing volume group:
# vgextend test_vg /dev/sdc1You can see, by viewing ‘vgdisplay’ again, it will show you the added space:
Volume group "test_vg" successfully extended
# vgdisplay
Now, pull it across into the logical volume:# lvextend -l +100%FREE /dev/test_vg/test_lvYou’re almost home free – now, vgdisplay shows the correct info and so does lvdisplay – but a simple df -h still shows the filesystem size has not changed. Let’s tell the filesystem to stretch out across the full logical volume:
Extending logical volume test_lv to 6.88 TiB
Logical volume test_lv successfully resized
# resize2fs /dev/test_vg/test_lvAnd to see how it worked out:
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/test_vg/test_lv is mounted on /TEST; on-line resizing required
old desc_blocks = 347, new_desc_blocks = 441
Performing an on-line resize of /dev/test_vg/test_lv to 1848109056 (4k) blocks.
The filesystem on /dev/test_vg/test_lv is now 1848109056 blocks long.
# df -hIt worked!
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/test_vg-test_lv 6.8T 4.9T 1.9T 73% /TEST
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Resize Linux storage with LVM
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://androidblackberries.blogspot.com/2012/01/resize-linux-storage-with-lvm.html. Terima kasih sudah singgah membaca artikel ini.Ditulis oleh Unknown
Rating Blog 5 dari 5
0 komentar:
Posting Komentar