Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have cloned a 160Gb disk onto a 1TB disk.

See here for the exact details. Clone ubuntu linux hard disk

I want the use the entire disk.

How do i get the volume to use the whole disk.

There where some suggestions in the previous post and i have googled around, But i'm not confident what is the best way forward.

Thanks

$ sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd42ad42a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19426   156039313+  8e  Linux LVM
/dev/sda2           19427       19457      249007+   5  Extended
/dev/sda5           19427       19457      248976   83  Linux

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2c9c2c9b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       19457   156288321   83  Linux

$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               AO-0023
  PV Size               148.81 GiB / not usable 2.14 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              38095
  Free PE               0
  Allocated PE          38095
  PV UUID               9QOBa4-SKHd-P82d-LDi7-gYh6-6hT8-2eezF1

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               AO-0023
  PV Size               149.05 GiB / not usable 1.31 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              38156
  Free PE               0
  Allocated PE          38156
  PV UUID               yeBtIS-UrEE-9Is8-QkEC-Rzl3-s7RL-gVvReI


~$ sudo lvdisplay
  --- Logical volume ---
  LV Name                /dev/AO-0023/root
  VG Name                AO-0023
  LV UUID                rc2Nwi-gxSQ-S2lZ-GOS1-af2g-mSR9-rAYsCm
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                143.12 GiB
  Current LE             36640
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           251:0

  --- Logical volume ---
  LV Name                /dev/AO-0023/swap_1
  VG Name                AO-0023
  LV UUID                CzZtTB-hpDT-G7co-OvZ7-Xa4K-IpOq-tyuz1H
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                5.68 GiB
  Current LE             1455
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           251:1

  --- Logical volume ---
  LV Name                /dev/AO-0023/copy
  VG Name                AO-0023
  LV UUID                kKpe1x-OtsI-vvJu-t5Ei-jhOt-ufLC-s1GsRh
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                149.05 GiB
  Current LE             38156
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           251:2

$ sudo vgdisplay
  --- Volume group ---
  VG Name               AO-0023
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               297.86 GiB
  PE Size               4.00 MiB
  Total PE              76251
  Alloc PE / Size       76251 / 297.86 GiB
  Free  PE / Size       0 / 0
  VG UUID               J4wgRy-EaDi-07A0-0Wyc-6IOG-dt82-Pdcics
share|improve this question

1 Answer 1

up vote 3 down vote accepted

You grow LVM by either:

  • Resizing the underlying block device and running pvresize, or
  • Adding additional PVs to your volume group.

Your disk information above is a little unclear, so I'm going to ignore it and give you a general description of the procedure. If your 1TB disk is otherwise empty, except for the LVM partition, then you can simply:

  • Use fdisk to increase the size of the partition
  • Use pvresize to grow the LVM PV to match the size of the partition.

If you're mixing LVM PVs on your disk with other partitions...don't do that. But if you insist, you can create an additional partition covering the extra space, and then add it to your volume group:

  • pvcreate /dev/sd??
  • vgextend vg0 /dev/sd??
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.