I have installed Ubuntu 12.10 as the only OS on my system.
I told Ubuntu to overwrite everything as I was in a hurry, hence I only have the two partitions Ubuntu creates, the Boot Partition of a couple a hundred MB, and then everything else.
The main partition is about 600GB,
I wish to resize this to 450GB, so I can install Windows 8 as a dual boot.
The issue is that I cannot work out how to shrink the partition, normally it's fine from the Gparted (gparted-live-0.14.1-6-i486.iso) live iso, Simply resize and you are good to go.
But this time Ubuntu has been installed with LVM.
So, the Ubuntu partition has a lock icon next to it.
This prevents me from doing anything, I can select the partition, and there is an option for "deactivate" which If I am correct I believe is deactivating swap? If I do that I can manipulate the partition.
I am asking here if this is the correct thing to do before I bust my system.
- Boot from the live gparted iso.
- Select the Ubuntu partition.
- "Deactivate" the partition.
- Resize the partition.
- "Activate" the partition.
- Apply.
- Profit???
Is my thinking correct?
So, after some extended chat I came down to this command
sudo lvresize --verbose --resizefs -L -150G /dev/ubuntu/root
Which successfully shrunk the logical partition.
But Now I have the hard part.
Now I need to shrink the Physical Partition down so I can create a new Physical partition with the space to install Windows 8.
So I thought I could run
pvresize --setphysicalvolumesize {any size here} /dev/sda5
But I get back:
/dev/sda5: cannot resize to xxxxx extents as later ones are allocated.
Which I believe is due to the swap due to this image:
, so what's my next step?
$: lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu/root
LV Name root
VG Name ubuntu
LV UUID G7Z3dA-xska-8QpO-Y5oD-aIVO-D8l1-22s6dO
LV Write Access read/write
LV Creation host, time ubuntu, 2013-01-29 22:06:02 +1300
LV Status available
# open 1
LV Size 540.42 GiB
Current LE 138348
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/ubuntu/swap_1
LV Name swap_1
VG Name ubuntu
LV UUID 14qpRy-H5jl-dTAq-CVle-k7Bz-95Rm-Y46zOs
LV Write Access read/write
LV Creation host, time ubuntu, 2013-01-29 22:06:04 +1300
LV Status available
# open 2
LV Size 7.97 GiB
Current LE 2041
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
Note that the above shot is taken from the Gparted version in the Ubuntu Repositories, not the latest version
matthew@play:~$ sudo fdisk -l
Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 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 identifier: 0x000c5bec
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 1465147391 732322817 5 Extended
/dev/sda5 501760 1465147391 732322816 8e Linux LVM
Disk /dev/mapper/ubuntu-root: 741.3 GB, 741334843392 bytes
255 heads, 63 sectors/track, 90128 cylinders, total 1447919616 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 identifier: 0x00000000
Disk /dev/mapper/ubuntu-root doesn't contain a valid partition table
Disk /dev/mapper/ubuntu-swap_1: 8560 MB, 8560574464 bytes
255 heads, 63 sectors/track, 1040 cylinders, total 16719872 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 identifier: 0x00000000
Disk /dev/mapper/ubuntu-swap_1 doesn't contain a valid partition table
matthew@play:~$ sudo lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
root ubuntu -wi-ao-- 690.42g
swap_1 ubuntu -wi-ao-- 7.97g
matthew@play:~$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu 1 2 0 wz--n- 698.39g 0
matthew@play:~$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 ubuntu lvm2 a-- 698.39g 0
No comments:
Post a Comment