Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/home partition with LVM [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Wed May 20, 2020 7:09 pm    Post subject: /home partition with LVM [SOLVED] Reply with quote

When creating a separate partition for the /home directory, it is generally straightforward to include the PARTUUID in fstab so that the directory is seen when the system is booting up. But when you want to combine two or more partitions from different physical disks for hosting the /home directory a solution might be to use LVM to combine all partitions into one logical volume.

I have seen in several websites that PARTUUID's for LV aren't recognized (in the sense that placing a line in fstab would make the directory visible to the system). Is this true? If so, how could a logical volume (created by two or more partitions using LVM) be used to host the /home directory and still be visible to the system?

many thanks!


Last edited by neyuru on Mon Jun 01, 2020 10:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Wed May 20, 2020 7:19 pm    Post subject: Reply with quote

neyuru,

You use the filesystem UUID in /etc/fstab
blkid:
/dev/mapper/vg-home: UUID="8d5d5691-ceb7-4e58-bed3-28803cb88bfe" BLOCK_SIZE="4096" TYPE="ext4"

There is no PARTUUID for a logical volume.
/etc/fstab:
UUID=8d5d5691-ceb7-4e58-bed3-28803cb88bfe /home                    ext4  noatime         1 2

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Wed May 20, 2020 9:23 pm    Post subject: Reply with quote

Thanks!

I gather, the cleanest solution is to create the home partition during installation (which I don't mind, I am still testing*), place the line in fstab and the system will take care of the rest, right? (automatically detecting and mounting /home in the specified UUID given in fstab)

*PS I have installed Gentoo in physical machines close to 7 times already since I first started over a month ago :lol:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Wed May 20, 2020 9:46 pm    Post subject: Reply with quote

neyuru,

Yes. Partition the way you want to during the install and put your filesystem tree together the way you like it.
Then untar the stage3, so everything goes in the right places.

If you have the space, its trivial to add more volumes to the filesystem tree. Well, until you run out of connectors to add more HDD :)

You rarely need to reinstall Gentoo as its usually possible to get from where you are to where you want to be.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 815

PostPosted: Thu May 21, 2020 10:13 am    Post subject: Reply with quote

In my opinion using UUID's doesn't make sense when using LVM.

The use-case for UUID's is to be able to find the right partition when the device names a dynamic. In LVM you already have static device names, either /dev/<vg name>/<lv name> and/or /dev/mapper/<vg name>-<lv name>. On all my machines where i use LVM i always refer to those device names in fstab, they are available right after the "lvm" initscript has been run.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Tue May 26, 2020 11:11 pm    Post subject: Reply with quote

I made an attempt at using UUIDs in fstab in a clean installation. The bootloader correctly found the root partition (e.g. the command line root=UUID=XXX-YYY-ZZZ was appended to the bootloader and correctly started the boot process) but then the boot process complained about not finding the swap. I double checked the UUIDs but I had to revert back to using PARTUUIDs. I had to write everything in PARTUUIDs as only writing it for the swap partition didn't helped.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Wed May 27, 2020 5:04 pm    Post subject: Reply with quote

neyuru

How does PARTUUID work with a logical volume?

My logical volumes don't have a PARTUUID reported by blkid.
Code:
/dev/mapper/vg-usr: UUID="7f0fad34-6130-42d8-8246-033de9717005" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg-local: UUID="54b46458-d411-4ea8-8920-4c5fcdb56a81" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg-tmp: UUID="59c06fd1-8471-4efb-b055-8f1cfb39645f" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg-var: UUID="57b34894-f80d-47ab-a522-46fb6e1a19b8" BLOCK_SIZE="4096" TYPE="ext4"
/dev/dm-4: UUID="e41a94cc-0817-449f-8ac8-f3055d33879c" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg-portage: UUID="8675cb9c-4251-489f-8e9b-0244ca80176c" BLOCK_SIZE="1024" TYPE="ext2"
/dev/mapper/vg-home: UUID="8d5d5691-ceb7-4e58-bed3-28803cb88bfe" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-root: UUID="cf559dbe-81bb-45b7-bbdd-0bcdc81e066b" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-usr: UUID="24e36648-f410-40b8-931f-41ad46741a47" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-var: UUID="1c981da8-f0f6-4953-b485-8dbc9e7c6879" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-local: UUID="17457b1b-ce7f-4452-93d6-4ffbdc04eddb" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-opt: UUID="c486b7cc-6df4-4a55-8add-0691db3bbc02" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/static-portage: UUID="350c56dc-7519-47e4-9cea-ef0bb23bdbb0" BLOCK_SIZE="1024" TYPE="ext4"

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Thu May 28, 2020 6:45 pm    Post subject: Reply with quote

NeddySeagoon wrote:
neyuru

How does PARTUUID work with a logical volume?


Sorry, I didn't explained myself correctly. I meant that I did another clean install (that's my hobby nowadays :lol: ) and gentoo didn't pass the boot phase. What I was trying to do was to test UUID's before installing LVM and as that failed I never installed LVM.
Back to top
View user's profile Send private message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Thu May 28, 2020 7:24 pm    Post subject: Reply with quote

I've determined the problem. My bootloader (systemd-boot) does not recognize UUIDs. I've changed to UUIDs all my partitions in fstab and I can correctly boot into my GUI. But I have to place a root=PARTUUID=XXX-YYY-ZZZ command line option to pass to the kernel in systemd-boot to boot correctly.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Thu May 28, 2020 7:42 pm    Post subject: Reply with quote

neyuru,

Thank you. You have two separate issues tangled up there.

When the system boots, it has to be told where the root filesystem is separately to /etc/fstab. As /etc/fstab is on the root filesystem, it can't be read until root is mounted.
Hence the root= on the kernel command line.

There are lots of ways to specify the location of the root filesystem but only two work without an initrd. That's PARTUUID and /dev/... where /dev is a real block device.
I see from the kernel help that LVM may work there but that's new and I've not tried it.

Filesystem UUID, LABEL and root on a Logical Volume all require the use of the user space mount command.
That forces the use of an initrd so you have some user space before root is mounted.

None of this is anything to do with the boot loader.
The boot loader loads the kernel, optionally the initrd, leaves the kernel command line for the kernel to find than jumps to the start address of the kernel.
Now its just the kernel and optional initrd to mount root so that boot can continue.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
neyuru
Apprentice
Apprentice


Joined: 21 Mar 2020
Posts: 191

PostPosted: Mon Jun 01, 2020 10:41 pm    Post subject: Reply with quote

NeddySeagoon wrote:

There are lots of ways to specify the location of the root filesystem but only two work without an initrd. That's PARTUUID and /dev/... where /dev is a real block device.


If only I knew that I could've saved a few minutes of testing :roll:

As all things you've got to do it if you want to learn it...

thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum