You are not logged in.

#1 2013-07-07 05:50:45

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 62

[SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Since more than half a year I am on a quest looking for the right system environment which brought me to Arch. Probably the fact to be on that quest without ending is a strong argument taht Arch could be my operation system. Still I want to try out without interferring with my present operation system (Ubuntu 12.10) before deciding.

For this I need to prepare my disk to give free some space for the Arch test installation. Unfortunately the descriptions about partitioning in the wiki (partitioning, gdisk) are mostly for szenarios wehere you are partitioning from scratch which is not the case here. So basically my situation is this:

sda                        8:0    0 298,1G  0 disk 
├─sda1                     8:1    0   243M  0 part /boot
├─sda2                     8:2    0     1K  0 part 
└─sda5                     8:5    0 297,9G  0 part 
  ├─ubuntu-root (dm-0)   252:0    0   294G  0 lvm  /
  └─ubuntu-swap_1 (dm-1) 252:1    0   3,9G  0 lvm  [SWAP]
sr0                       11:0    1  1024M  0 rom  

The partitions table is MBR (gparted shows msdos).

So my questions are, can I use gdisk to take space from dm-0 and out of the LVM to build a new partition for Arch outside of LVM?
Can change the partition table from MBR to GPT?
What are things I have to take care of in that process?

If I overlooked informations in the wiki, please apologize. I am still in the process of orientation is Arch.

Thx

Last edited by cutuchiqueno (2013-08-04 19:22:47)

Offline

#2 2013-07-07 05:54:02

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

This is what LVM is made for.  Please do a bit of searching on how to use LVM2's amazing tools.  Otherwise, you could simply try a virtual machine first, then install onto bare metal if you decide it is for you.

Offline

#3 2013-07-31 15:31:31

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 62

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Following the wiki I have resized with resize2fs and lvreduce, so there is a lot of space available within the volume group:

root@partedmagic:~# vgdisplay 
  --- Volume group ---
  VG Name               ubuntu
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               297,85 GiB
  PE Size               4,00 MiB
  Total PE              76249
  Alloc PE / Size       44508 / 173,86 GiB
  Free  PE / Size       31741 / 123,99 GiB
  VG UUID               9whdV1-Ie4K-XXDA-4QpJ-D7pa-wW26-2CdIps

So 123,99G not used space.  What I couldn't find nowhere is how I get this space out of the volume group to create a new volume group for Arch.

I treid with

pvresize --setphysicalvolumesize 180G /dev/sda5

but it tells me:

/dev/sda5: cannot resize to 46079 extents as later ones are allocated.
  0 physical volume(s) resized / 1 physical volume(s) not resized

So now I got really stucked.

Last edited by cutuchiqueno (2013-07-31 15:32:46)

Offline

#4 2013-07-31 17:12:40

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Wait, why are you trying to split off that now freed area?  Wouldn't it be much more sane of a solution to simply create a new logical volumes within your existing volume group?

There is no reason why you would need to have a separate volume group to instal Arch Linux to.  They could very easily and very sanely share the same space.  So just create a new one (or more) and go about the installation.

Keep in mind too that unless you are doing somethign silly like hibernating ubuntu and then booting into Arch, you can also share the swap space between the machines.  So there should be no need to waste drive space on more swap.

Offline

#5 2013-08-01 01:30:06

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Don't use gdisk unless you want to convert the disk to GPT. Use fdisk or cfdisk instead.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#6 2013-08-02 11:32:31

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 62

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Thx to you both. I took the suggestion of WonderWoofy just making a new Logical Volume out of the free space, so here we are:

niels@R8DY69X:~$ sudo lsblk -f
[sudo] password for niels: 
NAME                       FSTYPE      LABEL MOUNTPOINT
sda                                          
├─sda1                     ext2              /boot
├─sda2                                       
└─sda5                     LVM2_member       
  ├─ubuntu-root (dm-0)     ext4              /
  ├─ubuntu-swap_1 (dm-1)   swap              [SWAP]
  └─ubuntu-lvolarch (dm-2) ext4              
sr0  

The problem now is that GRUB can't boot into Arch. What I have done:

after that I did the Installtion process of Arch up to Install and configure a bootloader because I alreday have one from the Ubuntu installation which is located at sda1.

What I thought would be right to do is updating the existing bootloader. Knowing that os-prober and the right grub package is already installed in ubuntu I booted into ubuntu and tried update-grub. No Arch Linux found, after googling I found an approach mounting ubuntu-lvolarch and doing it again. So the script found the Arch Installation and created an entry in grub.cfg like this:

Arch auf /dev/mapper/ubuntu-lvolarch gefunden
menuentry 'Arch' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-6d2320dd-d0e6-43db-bf24-201cca49b2ce' {
	insmod part_msdos
	insmod lvm
	insmod ext2
	set root='lvm/ubuntu-lvolarch'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='lvm/ubuntu-lvolarch'  6d2320dd-d0e6-43db-bf24-201cca49b2ce
	else
	  search --no-floppy --fs-uuid --set=root 6d2320dd-d0e6-43db-bf24-201cca49b2ce
	fi
	linux /boot/vmlinuz-linux root=/dev/dm-2
	initrd /boot/initramfs-linux.img
}
submenu 'Erweiterte Optionen für Arch' $menuentry_id_option 'osprober-gnulinux-advanced-6d2320dd-d0e6-43db-bf24-201cca49b2ce' {
	menuentry 'Arch (auf /dev/mapper/ubuntu-lvolarch)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--6d2320dd-d0e6-43db-bf24-201cca49b2ce' {
		insmod part_msdos
		insmod lvm
		insmod ext2
		set root='lvm/ubuntu-lvolarch'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint='lvm/ubuntu-lvolarch'  6d2320dd-d0e6-43db-bf24-201cca49b2ce
		else
		  search --no-floppy --fs-uuid --set=root 6d2320dd-d0e6-43db-bf24-201cca49b2ce
		fi
		linux /boot/vmlinuz-linux root=/dev/dm-2
		initrd /boot/initramfs-linux.img
	}
}

After rebooting and choosing 'Arch' from GRUB menu I got into fallback because the root partition of Arch at /dev/dm-2 could not be found

Decompressing Linux... Parsing ELF... done.
Booting the kernel.
:: running early hook [udev]
:: Triggering uevents...
Waiting 10 seconds for device /dev/dm-2 ...
ERROR: device '/dev/dm-2' not found. Skipping fsck.
ERROR: Unable to find root device '/dev/dm-2'.

so I tried manually creating an entry in /etc/grub.d/40_custom following the GRUB Wiki page

# (0) Arch Linux
menuentry "Arch Linux Versuch" {
  insmod lvm
  set root=lvm/ubuntu-lvolarch
  linux /boot/vmlinuz-linux root=/dev/mapper/ubuntu-lvolarch ro
  initrd /boot/initramfs-linux.img
}

After running update-grub again there was not really an entry created like the one above but the text was just copied (Don't know if this is right). Anyhow, I just rebooted, had to go into GRUB menu with holding the shift key, saw my entry and tried to boot into Arch. The same error mesage appeared, this time with '/dev/mapper/ubuntu-lvolarch' instead of 'dev/dm-2'

So I ran out of ideas. What can I do to correctly reference the Arch Linux root device, as obviously I am not doing it now.

Offline

#7 2013-08-02 21:32:29

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

It is normal for it to just copy the entry as is.

Where are the Arch kernel and initramfs installed? Because your entry is assuming they are on dm-2. Is that right?


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#8 2013-08-03 08:09:27

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 62

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Following the output from lsblk (see above) dm-2 is referring to the Logical Volume ubuntu-lvolarch. When I boot into Ubuntu and mount /dev/dm-2 from there it is alos mounting the right Logical Volume, so at least within the ubuntu environment dm-2 is the Arch installation. Also the URLs to the kernel and initramfs are right set. They are located at dev/dm-2/boot/...

Offline

#9 2013-08-03 20:51:58

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

I just realised that it seems to be finding the initramfs and kernel so I'm not sure this is really a grub configuration problem.

Can you post mkinitcpio.conf?


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#10 2013-08-04 19:16:31

cutuchiqueno
Member
Registered: 2013-07-06
Posts: 62

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

The reference to mkinitcpio.conf was the magic hint. I used it to search in the forum and actually recognized that the lvm2 hook is not set by default but I need it when boot is on a Logical Volume. So I added it and everything works fine.

Sorry for posting I now see that there are a lot of similar problems discussed in the forum but as an Arch newbie I needed that push into the right direction to find the rest of the way, thx for that.

Offline

#11 2013-08-04 19:47:09

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

Neat, I'm glad you figured this out.  LVM is pretty awesome and provides some really great features. 

Unfortunately, when there was teh switch from the basic shell assembly of the lvm in the initramfs to using lvmetad, I hit a bug that was giong around.  So I switched to btrfs at that point.  But I was a happy LVM2 user for quite some time, and really enjoyed the flexability it provided in resizing partitions.  What is really nice is that it doesn't matter where the empty space is - between partitions, at the end, at the beginning - LVM2 can always make use of it and extend any partition into those spaces. 

I would advise using a filesystem that allows you to resize easily though.  At this point, there are not many that will allow you shrink partitions.  Many will allow for growth, but shrinking is not common.  Ext4 allows for this when the filesystem is offline, and btrfs allows for it both on and offline.  But if yuo are going to use btrfs, there is no real need for LVM (except in your situation where you already have an LVM2 setup).

Offline

#12 2013-08-04 19:55:24

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] Reorganizing Partitions to Install Arch in Dual Boot

cutuchiqueno wrote:

The reference to mkinitcpio.conf was the magic hint. I used it to search in the forum and actually recognized that the lvm2 hook is not set by default but I need it when boot is on a Logical Volume. So I added it and everything works fine.

Sorry for posting I now see that there are a lot of similar problems discussed in the forum but as an Arch newbie I needed that push into the right direction to find the rest of the way, thx for that.

Really, I don't think that was a problem. You don't even have to be a newbie to have trouble figuring out that the problem is actually with X and not Y or that it is with Y rather than who-knows-what-the-hell wink.

I'm glad my question was useful!

Last edited by cfr (2013-08-04 19:55:58)


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

Board footer

Powered by FluxBB