Skip to contentSkip to conversation

Freeing space on a LVM for other partitions

linux-lvm Richard Blumel 1 participant 2 messages Feb 9, 2006 – Feb 10, 2006

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I currently have this setup on a hw raid 0+1

[root@cranium][pts/2]:~# fdisk -l

Disk /dev/sda: 320.0 GB, 320073629696 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3732    29977258+   7  HPFS/NTFS
/dev/sda2            3860        5076     9775552+  83  Linux
/dev/sda3            5077       38913   271795702+  83  Linux
/dev/sda4            3733        3859     1020127+   5  Extended
/dev/sda5            3733        3859     1020096   82  Linux swap /

Solaris

[root@cranium][pts/2]:~# vgdisplay
  --- Volume group ---
  VG Name               raid01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               259.20 GB
  PE Size               4.00 MB
  Total PE              66356[root@cranium][pts/2]:~# lvdisplay
  --- Logical volume ---
  LV Name                /dev/raid01/usr
  VG Name                raid01
  LV UUID                khBZSv-3q6S-OKeX-NHJz-PdC5-FK9C-or6BDb
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                15.00 GB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:0

--- Logical volume ---

  LV Name                /dev/raid01/var
  VG Name                raid01
  LV UUID                gxbp4O-pL6I-Ye5o-Yvqp-nrmB-7Q51-8psyn2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                5.00 GB
  Current LE             1280
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:1

--- Logical volume ---

  LV Name                /dev/raid01/tmp
  VG Name                raid01
  LV UUID                awX51K-guHb-oAbZ-mvnd-SBg0-YM87-IR5BXQ
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:2

--- Logical volume ---

  LV Name                /dev/raid01/home
  VG Name                raid01
  LV UUID                R6ZBTP-y7LF-1pGl-u1be-lFx4-G31b-qZuCLU
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                208.20 GB
  Current LE             53300
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           254:3
  Alloc PE / Size       58676 / 229.20 GB
  Free  PE / Size       7680 / 30.00 GB
  VG UUID               Md0gWC-47Kj-CAft-W9D8-G420-tzQl-34sMBk

What I want to do is shrink the /dev/sda3 partition which is lvm, not sure why is says just link but eh. Once shrunk I am going to grow the ntfs partition which I know how todo. My problem is most of the howto talk about moving pv to remove pv so forth. I saw one post that said what I am trying todo is voodoo and dangerous but recommend that to move the PE towards one edge of the disk us --alloc anywhere however I have seen other documents that say that is not implemented yet. I hope I haven't lost you guys but if you know what I should I would be greatly in your debt.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD6tJL48JsCLyRVlARAiMuAJ4i3mOV0QkQaFs1axWDZOpRXfFVAgCfbJjp GDdeXvoG0Lcs/gzgwm1Gprk=
=24e7
-----END PGP SIGNATURE-----

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 96 lines · Richard Blumel

I currently have this setup on a hw raid 0+1

[root@cranium][pts/2]:~# fdisk -l

Disk /dev/sda: 320.0 GB, 320073629696 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 3732 29977258+ 7 HPFS/NTFS
/dev/sda2 3860 5076 9775552+ 83 Linux
/dev/sda3 5077 38913 271795702+ 83 Linux
/dev/sda4 3733 3859 1020127+ 5 Extended
/dev/sda5 3733 3859 1020096 82 Linux swap /
Solaris

[root@cranium][pts/2]:~# vgdisplay
--- Volume group ---
VG Name raid01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 259.20 GB
PE Size 4.00 MB
Total PE 66356[root@cranium][pts/2]:~# lvdisplay
--- Logical volume ---
LV Name /dev/raid01/usr
VG Name raid01
LV UUID khBZSv-3q6S-OKeX-NHJz-PdC5-FK9C-or6BDb
LV Write Access read/write
LV Status available
# open 1
LV Size 15.00 GB
Current LE 3840
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:0

--- Logical volume ---
LV Name /dev/raid01/var
VG Name raid01
LV UUID gxbp4O-pL6I-Ye5o-Yvqp-nrmB-7Q51-8psyn2
LV Write Access read/write
LV Status available

# open 1
LV Size 5.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:1

--- Logical volume ---
LV Name /dev/raid01/tmp
VG Name raid01
LV UUID awX51K-guHb-oAbZ-mvnd-SBg0-YM87-IR5BXQ
LV Write Access read/write
LV Status available

# open 1
LV Size 1.00 GB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:2

--- Logical volume ---
LV Name /dev/raid01/home
VG Name raid01
LV UUID R6ZBTP-y7LF-1pGl-u1be-lFx4-G31b-qZuCLU
LV Write Access read/write
LV Status available

# open 1
LV Size 208.20 GB
Current LE 53300
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:3

Alloc PE / Size 58676 / 229.20 GB
Free PE / Size 7680 / 30.00 GB
VG UUID Md0gWC-47Kj-CAft-W9D8-G420-tzQl-34sMBk

Quoted 9 lines

What I want to do is shrink the /dev/sda3 partition which is lvm, not sure why is says just link but eh. Once shrunk I am going to grow the ntfs partition which I know how todo. My problem is most of the howto talk about moving pv to remove pv so forth. I saw one post that said what I am trying todo is voodoo and dangerous but recommend that to move the PE towards one edge of the disk us --alloc anywhere however I have seen other documents that say that is not implemented yet. I hope I haven't lost you guys but if you know what I should I would be greatly in your debt.

Ok I solved this problem on my own and I am sure other people want to know how I did it. Once I used pvresize to shrink the pv I was left with a partition that was 20G bigger than I wanted to use and I wanted to reclaim that 20G for my ntfs partition. I assumed that I could use parted to resize this down, I was wrong. So what I did was delete the partition in fdisk and then made a new partition that had the same start but 20G short on the end. Like I said I assumed that this space was completely unused. I had a backup of my data cause of a raid 0+1 that I failed out raid 1. This worked and I now have

[root@cranium][pts/1]:~# fdisk  -l

Disk /dev/sda: 320.0 GB, 320073629696 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        6201    49809501    7  HPFS/NTFS
/dev/sda2            6329        7545     9775552+  83  Linux
/dev/sda3            7546       38913   251963460   83  Linux
/dev/sda4            6202        6328     1020127+   f  W95 Ext'd (LBA)
/dev/sda5            6202        6328     1020096   82  Linux swap /

Solaris

I orig had a problem with the space being at the end and I could use it their. So I used partition magic 8.0 and moved all the data over by 20G. This took 12hrs... heh. All my data is intact so I reconstructed my raid 1. Good times. I cant believe this worked, it was voodoo.
_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD7Otc48JsCLyRVlARAo27AJ44br1TcpVSLeKbzjNl15oiYzsoGQCaA3KN GVZvpMNBJ9ddBPhb+7Q60m8=
=zE4d
-----END PGP SIGNATURE-----