Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LVM recommendations?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Wed Jun 07, 2017 12:23 pm    Post subject: LVM recommendations? Reply with quote

I am planning to move a fresh installed system from a regular ext4 formatted partition to a logical volume on another partition.
The kernel is an EFI stub, directly started by the UEFI firmware. No Grub2 or such.
The instructions I saw for moving the system are from https://sysresccd.org/.

Questions I have:
  • For emerging sys-fs/lvm2, is the thin USE flag recommended? (It's trying to pull in dev-libs/boost.)
  • The lvm2create_initrd USE flag, should I need it for creating an initramfs?
  • If the root device is /dev/mapper/VolGroup1-root, what to put into the kernel's CONFIG_CMDLINE? The wiki article isn't very clear at this.
  • What is the recommendation for swap? Swap file in root logical volume, or in a separate logical volume or even outside LVM on a separate partition?
  • Set up and test suspend and hibernation before moving to lvm or after?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Wed Jun 07, 2017 6:48 pm    Post subject: Reply with quote

Without grub you're making it more difficult on yourself.
You will need an initramfs/initrd to have root on LVM.
If you want to have overcommit LVM volumes, you use thin. If it's a personal system, likely this doesn't make sense.
root=whatever you root partition needs to be, just as usual, except for the initramfs problem.
Swap wherever you want, it's faster to have it outside of LVM though if you plan to never use swap, it's fine being in a file in a LVM volume.
If you plan to suspend/hibernate, you should definitely test your hardware first to make sure it works properly to see if it's even worth setting up. Else you should do it after where you define your swap area as this is your hibernation store. I'm not sure if the kernel will read swap file extents properly if it's in a LVM volume so it's probably best to leave swap outside if you plan to hibernate.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1746

PostPosted: Wed Jun 07, 2017 7:15 pm    Post subject: Reply with quote

Quote:
For emerging sys-fs/lvm2, is the thin USE flag recommended? (It's trying to pull in dev-libs/boost.)
Are you going to use thin volumes?
They have potential of using less space than declared at cost of IO performance (particularly with low % of space used, gets more like full volume when you approach 100% allocated space)
Rumour says thin is more efficient when you create multiple snapshots (less IO overhead), though I haven't tested it enough to confirm from my experience yet. Full volumes are a bit safer though, as it attempts to occupy continuous space on the underlying device, effectively making it more predictable. This said, if you screw up and break your LVM, you have a better chance of recovering than from damaged thin lvm.
Anyway, there's no harm in having the use flag enabled beside the libs occupying slightly more space.
Quote:
The lvm2create_initrd USE flag, should I need it for creating an initramfs?
Not sure. Genkernel works just fine without it, though I'm ot sure how much magic happens behind scenes.
Quote:
If the root device is /dev/mapper/VolGroup1-root, what to put into the kernel's CONFIG_CMDLINE? The wiki article isn't very clear at this.

root=/dev/ram0 ramdisk=8192 real_root=/dev/mapper/VolGroup1-root dolvm (assuming you use genkernel's initramfs)
Yup, tricky stuff. Or at least less than obvious.
Quote:

What is the recommendation for swap? Swap file in root logical volume, or in a separate logical volume or even outside LVM on a separate partition?

Depends on your use case. How much RAM do you have? Do you use hibernation AKA suspend-to-disk? Do you do some heavy processing that would eat more RAM than you can afford?
I don't use SWAP at all. However, for hibernation you will need _some_ swap. I'd start with leaving a few gigs outside of LVM (because it's easy to pull it in later on and it's hard to split a chunk out) and create swap on a separate lvm volume. Hibernation image is compressed and only contains used memory, so it may take as little as 0.5 or 1 GB (or much more, depending on your use case). Either way install your base system first and check hibernation later.
If it succeeds (it should), add the "reserved" space to volume group. If it fails, try using it for swap instead of LVM.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Wed Jun 07, 2017 8:58 pm    Post subject: Reply with quote

eccerr0r and szatox,

Thank you both very much for your replies. I think I will do without "thin" for the moment. Learning lvm and having to use an initramfs is complex enough for the time being. Not sure if I should ever want to have "thin volumes".

Hibernation - I will test it when I have lvm up and running. The laptop can do it; I know from windows 10 installation. I forgot to mention it is a Dell Latitude E6430 with 16GB RAM, more than enough for what I can do with a laptop.

I never tried genkernel. For initramfs I used dracut. It worked and hopefully will work for lvm.

Regarding the kernel commandline, does it need to be different depending on the tool used for creating the initramfs?

Thanks again
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Wed Jun 07, 2017 9:21 pm    Post subject: Reply with quote

If you're insisting on using direct EFI boot without a bootloader, you will have to embed the initramfs inside the kernel (CONFIG_INITRAMFS_SOURCE). The command line needed will depend on what initramfs you're using. I don't know if there's any howtos out there with embedded initramfs though it should work...

Having a laptop be able to suspend/hibernate in Windows has no bearing of being able to do the same in Linux...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Jun 14, 2017 8:40 am    Post subject: Reply with quote

Discussion about switching to Grub from an EFI stub moved to UEFI not loading initramfs
_________________
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
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Sat Jun 17, 2017 3:50 pm    Post subject: Errors on shutdown Reply with quote

Thanks again people. For the time being I can use rEFInd as boot manager to workaround the initramfs problem.
Now I am having a very basic system with system root on lvm so I can start doing lvm snapshots and consistent backups and check other things like suspend and hibernate.

One problem I still have is on shutdown:
Code:
  Logical volume vg0/root contains a filesystem in use.
 * Failed (possibly some LVs still needed for /usr or root)


The full log of shutdown looks like:
Code:
rc shutdown logging started at Sat Jun 17 11:11:03 2017

 * Saving random seed ...
 [ ok ]
 * Stopping DHCP Client Daemon ...
 [ ok ]
 * Unmounting loop devices
 * Unmounting filesystems
 *   Unmounting /var/tmp/portage ...
 [ ok ]
 * Deactivating swap devices ...
 [ ok ]
 * Shutting down the Logical Volume Manager
 *   Shutting Down LVs & VGs ...
  Logical volume vg0/root contains a filesystem in use.
 * Failed (possibly some LVs still needed for /usr or root)
 [ !! ]
 * Finished shutting down the Logical Volume Manager
 * Stopping lvmetad ...
 [ ok ]
 * Stopping udev ...
 [ ok ]

rc shutdown logging stopped at Sat Jun 17 11:11:04 2017


rc shutdown logging started at Sat Jun 17 11:11:03 2017

 * Saving random seed ...
 [ ok ]
 * Stopping DHCP Client Daemon ...
 [ ok ]
 * Unmounting loop devices
 * Unmounting filesystems
 *   Unmounting /var/tmp/portage ...
 [ ok ]
 * Deactivating swap devices ...
 [ ok ]
 * Shutting down the Logical Volume Manager
 *   Shutting Down LVs & VGs ...
  Logical volume vg0/root contains a filesystem in use.
 * Failed (possibly some LVs still needed for /usr or root)
 [ !! ]
 * Finished shutting down the Logical Volume Manager
 * Stopping lvmetad ...
 [ ok ]
 * Stopping udev ...
 [ ok ]

rc shutdown logging stopped at Sat Jun 17 11:11:04 2017
And yes, it is always twice with same timestamp.

rc-update is like
rc-update:
               binfmt | boot                                   
             bootmisc | boot                                   
                devfs |                                 sysinit
               dhcpcd |      default                           
                dmesg |                                 sysinit
                 fsck | boot                                   
             hostname | boot                                   
              keymaps | boot                                   
            killprocs |                        shutdown       
    kmod-static-nodes |                                 sysinit
                local |              nonetwork                 
           localmount | boot                                   
             loopback | boot                                   
                  lvm | boot                                   
             mount-ro |                        shutdown       
                 mtab | boot                                   
               procfs | boot                                   
                 root | boot                                   
            savecache |                        shutdown       
                 swap | boot                                   
               sysctl | boot                                   
                sysfs |                                 sysinit
         termencoding | boot                                   
                 udev |                                 sysinit
         udev-trigger |                                 sysinit
              urandom | boot                                   
       wpa_supplicant |      default       


How to get a proper shutdown; Am I missing something?
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1746

PostPosted: Sat Jun 17, 2017 4:31 pm    Post subject: Reply with quote

That double log is weird. I can't really think of a scenario which would produce such an output, though I'd look for problems around logger itself.
Quote:
Code:
Logical volume vg0/root contains a filesystem in use.
 * Failed (possibly some LVs still needed for /usr or root)

This on the other hand is not a problem at all. You have root on LVM, right? So you can't shut LVM down.
Now, it is technically possible to switch root (or pivot root) to ramdisk again (hint:slax used to do that), but there is actually no point in doing it. Your root is mounted read-only at this point. All changes done during last session have already been flushed from RAM to disk. The image is consistent and marked as unmounted, and since no further changes will be made, it's safe to pull the plug.
Just ignore this message. It's harmless - and in fact openrc itself tells you this might be the case
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2613

PostPosted: Sat Jun 17, 2017 5:08 pm    Post subject: Reply with quote

Thanks for the explanation. I will try to ignore the * Failed ... messages.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Jun 17, 2017 5:11 pm    Post subject: Reply with quote

I get the same message about /usr as I have a separate /usr in LVM.

Its mounted -o ro by that time and its only written to for updates.
Any writes have long since been committed.
_________________
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
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7131
Location: almost Mile High in the USA

PostPosted: Sat Jun 17, 2017 9:00 pm    Post subject: Reply with quote

Ideally yes, the mounted filesystems are flushed, but how about the LVM metadata and possibly snapshot data (and for me, mdraid metadata too)...

Honestly I've been just rolling the dice, and fortunately I usually win the roll...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing 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