1

I'm a newbie to linux and partitioning and apologies in advance if this has been answered before; I've searched extensively on the web for answer, and after being unsuccessful I decided to post a question. With that out of the way, here is the problem description:

Running Ubuntu server 14.10 bare metal on a server with hardware raid which was configured in the BIOS. During installation I went with the default partitioning which ended up allocating most of the space to /root. First thing I did was to resize root partition, moving the /swap to be adjacent to /root, shrink the pv and vg successfully thanks to couple of posts here on the site. Now I'm not able to find way to use the new freed space as a new partition. Here are the details

 ~# fdisk --list

Disk /dev/sda: 1.6 TiB, 1796997120000 bytes, 3509760000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0f179d27

Device     Boot  Start        End    Sectors  Size Id Type
/dev/sda1  *      2048     499711     497664  243M 83 Linux
/dev/sda2       501758 3509757951 3509256194  1.6T  5 Extended
/dev/sda5       501760 3509757951 3509256192  1.6T 8e Linux LVM

Disk /dev/mapper/bce--os--cpy--vg-root: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 7.5 GiB, 8004304896 bytes, 15633408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdd1  *        2 15633407 15633406  7.5G  c W95 FAT32 (LBA)

Disk /dev/mapper/bce--os--cpy--vg-swap_1: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

When using GParted it shows that sda5 is a subset of sda2, which lead me to believe that sda2 here is my RAID. Gparted was only helpful to visualize the disk, other than that I couldn't utilize it and my understanding is that it doesn't support LVM. Also, I couldn't use system-config-lvm package because it's deprecated as I understand it.

here is the vgdisplay, pvdisplay, and lvdisplay details

~# vgdisplay
  --- Volume group ---
  VG Name               bce-os-cpy-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               75.00 GiB
  PE Size               4.00 MiB
  Total PE              19199
  Alloc PE / Size       18944 / 74.00 GiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               dO1C4A-WdnE-KdSf-U1Cs-9iOP-fg4P-KwSGFd

~# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               bce-os-cpy-vg
  PV Size               75.00 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              19199
  Free PE               255
  Allocated PE          18944
  PV UUID               SNkWK0-tkXG-Akza-qoDs-BcT3-3MEk-L53L0B

  --- Physical Segments ---
  Physical extent 0 to 2559:
    Logical volume  /dev/bce-os-cpy-vg/root
    Logical extents 0 to 2559
  Physical extent 2560 to 18943:
    Logical volume  /dev/bce-os-cpy-vg/swap_1
    Logical extents 0 to 16383
  Physical extent 18944 to 19198:
    FREE

~# lvdisplay -m
  --- Logical volume ---
  LV Path                /dev/bce-os-cpy-vg/root
  LV Name                root
  VG Name                bce-os-cpy-vg
  LV UUID                8u1Eqf-6FPF-DXzh-vBds-cUyq-c1Fm-ewuhxk
  LV Write Access        read/write
  LV Creation host, time bce-os-cpy, 2015-03-10 23:13:58 -0400
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Segments ---
  Logical extent 0 to 2559:
    Type        linear
    Physical volume /dev/sda5
    Physical extents    0 to 2559


  --- Logical volume ---
  LV Path                /dev/bce-os-cpy-vg/swap_1
  LV Name                swap_1
  VG Name                bce-os-cpy-vg
  LV UUID                H7wmEp-Aw90-aWV1-aGrd-2yMr-ZBkH-sS1Zty
  LV Write Access        read/write
  LV Creation host, time debian, 2015-03-23 18:38:31 -0400
  LV Status              available
  # open                 2
  LV Size                64.00 GiB
  Current LE             16384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

  --- Segments ---
  Logical extent 0 to 16383:
    Type        linear
    Physical volume /dev/sda5
    Physical extents    2560 to 18943

This is vgs,pvs,and lvs output

~# vgs
  VG            #PV #LV #SN Attr   VSize  VFree
  bce-os-cpy-vg   1   2   0 wz--n- 75.00g 1020.00m
root@bce-os-cpu:~# pvs
  PV         VG            Fmt  Attr PSize  PFree
  /dev/sda5  bce-os-cpy-vg lvm2 a--  75.00g 1020.00m
root@bce-os-cpu:~# lvs
  LV     VG            Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  root   bce-os-cpy-vg -wi-ao--- 10.00g
  swap_1 bce-os-cpy-vg -wi-ao--- 64.00g

fstab

~# cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/bce--os--cpy--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=e24ff838-71c8-42b1-a381-d89c6daf3be1 /boot           ext2    defaults        0       2
/dev/mapper/bce--os--cpy--vg-swap_1 none            swap    sw              0       0

So as you can see the disk size is 1.6T as shown in the fdisk output and after successfully (I think) shrinking vg,pv, and lv I have only used 75G and I want to use the freed space (how to find it?) to create a new partition.

1 Answer 1

0

sda is your hardware raid. sda5 is a subset of sda2 because sda2 is your extended partition, and sda5 is a logical partition. If you want to free up space for a new partition, you just need to shrink sda5 using gparted from a livecd.

1
  • Thanks for your help, this definitely solved my problem! The only odd thing is when I initially tried to resize sda5, I sled the resize bar all the way to the end of sda5 used space, but when I clicked ok, gparted added 33G for some reason, so I went back and sled the bar more and when I applied it again it spat an error. So I just left it with the extra space for now and was able to shrink it. Thanks a lot for looking into this!
    – mbachari
    Mar 31, 2015 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .