Adding centos to fedora install as dual boot - lvm problems
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Adding centos to fedora install as dual boot - lvm problems
I have a fedora installation that I've been using as a home server (I know - fedora was the *wrong* choice as a server as it changes to much; but it was a learning curve and served it's purpose). Now I want to upgrade to CentOS. I'm going to want to run them both initially as it will take me a while to get the new OS all set up with all the right s bits and pieces I want on it (get_iplayer, serviio, Pydio, Apache, ABCDE etc etc).
I've got a live USB and can boot from that, the problem comes when I select the "Reduce existing FS" option. It only shows me the boot partition and whatever I select simply says not enough space. The HDD is 250GB so I know it should be possible.
So on the current Fedora install:
Code:
[root@GDServer gary]# mount
/dev/mapper/vg_gdserver-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg_gdserver-lv_home on /home type ext4 (rw)
/dev/sdb on /audiovideo type ext4 (rw)
/dev/sdc on /data type ext4 (rw)
/dev/sdd on /backup type ext4 (rw)
Code:
[root@GDServer gary]# fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x0005104a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 488396799 243685376 8e Linux LVM
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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/sdc doesn't contain a valid partition table
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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/sdd doesn't contain a valid partition table
Disk /dev/dm-0: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 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/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1: 6174 MB, 6174015488 bytes
255 heads, 63 sectors/track, 750 cylinders, total 12058624 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/dm-1 doesn't contain a valid partition table
Disk /dev/dm-2: 189.6 GB, 189649649664 bytes
255 heads, 63 sectors/track, 23056 cylinders, total 370409472 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/dm-2 doesn't contain a valid partition table
sda is the OS
sdb, c and d are the NAS drives.
So, basically the question is a) am I doing something wrong? and b) if not, how do I shrink the fedora install so I can put the Centos on the same disk (sda) as a dual boot?
I've spent the day playing around and still no luck.
I've reduced the the underlying fs size and shrunk the logical volume, but nothing seems to make the volume group reduce in size.
The basic sequence of commands I've used is: (this is run on a test setup using a VM with fedora 20 installed on a 250G hard drive)
Quote:
vgchange -a y
e2fsck -f /dev/fedora/home
resize2fs /dev/fedora/home 90G # make about 90% of the final partition size
lvreduce -L 100G /dev/fedora/home
resize2fs /dev/fedora/home
So now the lv is smaller (started at about 200G), but the volume group is still using the whole partition
Quote:
lvm> pvscan
PV /dev/sda2 VG fedora lvm2 [249.51 GiB / 91.62 GiB free]
Total: 1 [249.51 GiB] / in use: 1 [249.51 GiB] / in no VG: 0 [0 ]
lvm> lvdisplay
--- Logical volume ---
LV Path /dev/fedora/swap
LV Name swap
VG Name fedora
LV UUID ZrFE3x-Yj7J-JN6e-9ZPM-53Lt-Fesr-sz0Be9
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:17 -0500
LV Status NOT available
LV Size 7.89 GiB
Current LE 2020
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Path /dev/fedora/home
LV Name home
VG Name fedora
LV UUID dtwDMp-Hcy7-4IbD-ozf3-RCoF-0uC1-QusTP9
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:17 -0500
LV Status NOT available
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID 8gtd26-E5uo-qTFx-nfCj-yGBJ-hwlS-v8JpKa
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:19 -0500
LV Status NOT available
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
When I try and install Centos, if I select shrink existing or use free space I get the same error:
Quote:
Could not allocate requested partitions: not enough free space on disks.
I've been Googling this all day but all I get are copycat "howto's" which I've already tried.
You need to use "pvresize --setphysicalvolumesize ..." to shrink LVM's view of the physical volume and then shrink the partition with fdisk. After each step it is advisable to check that everything is still intact and that you haven't inadvertently clipped the end off of something (though pvresize does check that you are not doing that).
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
home fedora -wi------- 100.00g
root fedora -wi------- 50.00g
swap fedora -wi------- 7.89g
[root@livecd centoslive]# pv
pvchange pvck pvcreate pvdisplay pvmove pvremove pvresize pvs pvscan pv.sh
[root@livecd centoslive]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size 249.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 63874
Free PE 23454
Allocated PE 40420
PV UUID 6i3tGr-GNcW-eD8c-JtOd-v6e8-rZFQ-MwtYyi
[root@livecd centoslive]# pvresize --setphysicalvolumesize 160G /dev/sda2
/dev/sda2: cannot resize to 40959 extents as later ones are allocated.
0 physical volume(s) resized / 1 physical volume(s) not resized
[root@livecd centoslive]# lvdisplay
--- Logical volume ---
LV Path /dev/fedora/swap
LV Name swap
VG Name fedora
LV UUID ZrFE3x-Yj7J-JN6e-9ZPM-53Lt-Fesr-sz0Be9
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:17 -0500
LV Status NOT available
LV Size 7.89 GiB
Current LE 2020
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Path /dev/fedora/home
LV Name home
VG Name fedora
LV UUID dtwDMp-Hcy7-4IbD-ozf3-RCoF-0uC1-QusTP9
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:17 -0500
LV Status NOT available
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID 8gtd26-E5uo-qTFx-nfCj-yGBJ-hwlS-v8JpKa
LV Write Access read/write
LV Creation host, time localhost, 2014-02-05 06:41:19 -0500
LV Status NOT available
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
[root@livecd centoslive]# pvdisplay --maps
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size 249.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 63874
Free PE 23454
Allocated PE 40420
PV UUID 6i3tGr-GNcW-eD8c-JtOd-v6e8-rZFQ-MwtYyi
--- Physical Segments ---
Physical extent 0 to 2019:
Logical volume /dev/fedora/swap
Logical extents 0 to 2019
Physical extent 2020 to 27619:
Logical volume /dev/fedora/home
Logical extents 0 to 25599
Physical extent 27620 to 51073:
FREE
Physical extent 51074 to 63873:
Logical volume /dev/fedora/root
Logical extents 0 to 12799
<reboot to fedora and all seems ok, boot back to centos>
Quote:
[root@livecd centoslive]# vgchange -ay
3 logical volume(s) in volume group "fedora" now active
[root@livecd centoslive]# e2fsck -f /dev/fedora/home
e2fsck 1.41.12 (17-May-2010)
/dev/fedora/home: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/fedora/home: ***** FILE SYSTEM WAS MODIFIED *****
/dev/fedora/home: 154/6553600 files (1.9% non-contiguous), 460126/26214400 blocks
[root@livecd centoslive]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size 160.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 40959
Free PE 539
Allocated PE 40420
PV UUID 6i3tGr-GNcW-eD8c-JtOd-v6e8-rZFQ-MwtYyi
[root@livecd centoslive]# vgdisplay
--- Volume group ---
VG Name fedora
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 160.00 GiB
PE Size 4.00 MiB
Total PE 40959
Alloc PE / Size 40420 / 157.89 GiB
Free PE / Size 539 / 2.11 GiB
VG UUID j8qNwE-wyU0-YVV2-H0fE-zbJz-XuUx-heS9tb
(parted) print /dev/sda
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 268GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 525MB 524MB primary ext4 boot
2 525MB 268GB 268GB primary lvm
(parted) resize 2 525MB 170GB
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Error: Could not detect file system.
So another brick wall. It seems that although I have reduced the size of the logical volumes and the volume group I still cannot resize the partition.
So as far as actually trying this on my real server.... uh, no thanks lol. I simply have to swap disks until the new one is up and running.
parted is simply the wrong tool. For a partition containing (just) a filesystem, it is clever enough to resize the filesystem along with the partition. Note that typing "help resize" from within parted will tell you this, and also tell you what types it can handle. Faced with a partition with content it does not understand, like an LVM PV or even an empty (all zero) partition, it refuses to do anything.
Just use fdisk to delete the partition and re-create it with the proper size.
I'm confused - I can't delete the partition as it still has the volume group on, hence trying to shrink the volume group to make space to resize the partition (to make space to install the second OS)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.