how do i get my drives extended

Latest response

I have duplicated two drives and cant get the new drives to show the new size they are now.

Went from a 500gb drive to a 2tb drive but when i check in lvm all it shows still is the 500gb.

How do i extend the lv, pv to show the full size of the drive.

I essentially just need to extend the lv.

Any help is appreciated.

Responses

Hi Nathan,

To extend the logical volume execute the following commands.
Replace VolumeGroup and LogicalVolume with your "specs". :)
Note : *MB = new size of logical volume/new size of file system

sudo e2fsck -f /dev/<VolumeGroup>/<LogicalVolume>
sudo lvextend -L *MB /dev/<VolumeGroup>/<LogicalVolume>
sudo resize2fs /dev/<VolumeGroup>/<LogicalVolume> *MB

Regards,
Christian

Generally, after you've extended the partition that the LVM2 PV lives on (if you've bothered to partition the disk at all), and have issued a pvresize /dev/<BLOCKDEV>, you can collapse those three steps down into:

lvextend -r -l 100%FREE /dev/<VOLGROUP>/<VOLNAME>

Hi Thomas,

Thanks for adding this alternative ... as always in Linux : there are "1000 ways" to achieve the same.

Cheers :)
Christian

I'm soooooooper lazy: if there's a way of doing something that requires fewer keystrokes, I'll typically find it. =)

HaHaHa ... nice Thomas ! :D :D :D

Hello Nathan,

Christian tell you how to extend the logical volume.

Please tell us at which level you have an issue.

  1. physical volumes

  2. logical volumes

  3. filesystems

if it is:

  1. show pvs

    a. pvextend the disk or extend the disk partion with fdisk or gparted on the disk you extended or replaced.

    b. extend the logical volume and filesystem the "Christain way"

  2. follow Christians example

  3. only perform the last command from Christian's recipe.

Remark about the 'Christian way' *MB can be removed, the default is fill up the Logical Volume to 99%.

Regards,

Jan Gerrit Kootstra

Hi Jan Gerrit,

Thank you for adding additional hints. I intentionally provided "*MB" just in case Nathan wants to specify the size. :)

Regards,
Christian

I ran: sudo e2fsck -f /dev//home

it shot back: /dev//home is mounted. e2fsck: Cannot continue, aborting.

So do i need to unmount that and load into a live disk to perform the steps you have listed?

Jan, I ran pvs and recieved: PV VG Fmt Attr PSize PFree /dev/sda3 lvm2 a-- 475.74g 0 /dev/sdb1 lvm2 a-- 931.50g 4.00m

I know they show as full but the drives were duplicated from smaller drives onto larger drives.

Thanks I will look at these again and see what I am missing.

You're welcome, Nathan ... and good luck ! :)

Love learning new stuff. Just stinks when im that novice linux user and the company wants we to perform quicker and faster.

I can feel with you, Nathan ... I can feel with you ... and - we all have been "noobs" at some point ! :)

Hi Nathan,

Ok, let us get back at your pvs output:

PV VG Fmt Attr PSize PFree
/dev/sda3 lvm2 a-- 475.74g 0
/dev/sdb1 lvm2 a-- 931.50g 4.00m

We see here that the first physical volume is situated on the partition /dev/sda3 (on disk /dev/sda) and the second on the partition /dev/sdb1 (on disk /dev/sdb).

To extend these partition is a bit dangerous.

So lets try something that is saver:

Create extra physical volumes using fdisk

First check if the partition I mention /dev/sda4 and /dev/sdb2 not exist:

fdisk -l /dev/sda
fdisk -l /dev/sdb

Let us create partition /dev/sdb4

fdisk -u /dev/sda
 n
  p
   4
(accept the give start and end sector)
w
q

(now you created partition /dev/sda4)

Let us create partition /dev/sdb2

fdisk -u /dev/sdb
 n
  p
   2
(accept the give start and end sector)
w
q

(now you created partition /dev/sdb2)

force the partition tables to be renewed on the disks /dev/sda and /dev/sdb

partprobe /dev/sda
partprobe /dev/sdb

Add the partition to the volume group, the physical volumes will automatically be created.

determine your volume group name this should be in the second column of the pvs output

vgextend your volume group name /dev/sda4 /dev/sdb2

From here you can use the lvextend and resize2fs commands, we mentioned before.

Regards,

Jan Gerrit Kootstra

And now, Jan Gerrit ? It shows us two physical volumes ... :)
Edit : Just saw that you are adding content, thank you Jan !

Regards,
Christian