Announcement

Collapse
No announcement yet.

Use thinly-provisioned LVM in Kubuntu

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Use thinly-provisioned LVM in Kubuntu

    When installing Kubuntu and you want to create manual LVM. But LVM you want to create is thin. Open Live Session. Make sure you have network access.

    Install thin-provisioning-tools:

    # apt-get install thin-provisioning-tools .....
    <-- you may need to enable "universe" repository in /etc/apt/sources.list

    Now install as usual. First create LVM thin pool and thin volumes as you need:

    # pvcreate /dev/sda5 ......(for example)
    # vgcreate kubuntu /dev/sda5 ......(again, example)
    # lvcreate kubuntu --thinpool thin -L size .....<-- "thin" is volume name

    # lvcreate -T kubuntu/thinpool -n root -V 15G
    # lvcreate -T kubuntu/thinpool -n home -V 30G .....<-- V specifies virtual size, may be bigger than -L size.

    Now make filesystems manually or proceed with installation:

    # mkfs.ext3 /dev/kubuntu/root
    # mkfs.ext3 /dev/kubuntu/home

    Install Kubuntu. Use LVM volumes for root, home, etc.

    Wait till install is finished. Go back to root shell.

    Chroot into /target:

    # cd /target
    # mount --bind /dev dev
    # mount --bind /sys sys
    # mount --bind /proc proc
    # chroot .

    Forget! Apt-get won't work in chroot. Go into other root shell (press ctrl-shift-T in Konsole, sudo su). Go to /var/cache/apt/archives.

    # cp /var/cache/apt/archives/* /target/tmp

    Back to first chroot shell:

    # dpkg -i /tmp/*.deb

    This will install thin-provisioning-tools in target system.

    Now create /etc/initramfs-tools/hooks/thin-provisioning-tools with content:

    Code:
    #!/bin/sh
    
    PREREQ="lvm2"
    
    prereqs()
    {
        echo ""
    }
    
    case $1 in
    prereqs)
        prereqs
        exit 0
        ;;
    esac
    
    . /usr/share/initramfs-tools/hook-functions
    
    copy_exec /usr/sbin/thin_check
    copy_exec /usr/sbin/thin_dump
    copy_exec /usr/sbin/thin_repair
    copy_exec /usr/sbin/thin_restore
    copy_exec /sbin/dmeventd
    
    
    manual_add_modules dm_thin_pool
    Change perms:

    # chmod /etc/initramfs-tools/hooks/thin-provisioning-tools

    Run update-initramfs-tools:

    # update-initramfs-tools -u

    Presto! On reboot will work, otherwise won't work.

    Check initramfs for test:

    # lsinitramfs /initrd.img | grep thin

    usr/sbin/thin_dump
    usr/sbin/thin_restore
    usr/sbin/thin_check
    usr/sbin/thin_repair
    lib/modules/x.y.z-a-generic/kernel/drivers/md/dm-thin-pool.ko
    lib/modules/x.y.z-a-generic/kernel/drivers/hid/hid-thingm.ko

    Is included in initramfs now. Boot should work.

    Otherwise won't load LVM & kernel panic.

    Good luck!

    #2
    I was mistaken about one thing:

    Grub does not understand thin LVM volumes. It will see them but won't be able to access them. Then grub-probe will fail when doing update-grub. This only applies to the mounted root filesystem. Your root cannot be on thin LVM for update-grub to work. If you have separate boot partition, however, grub-install will still work fine (if you have self-maintained grub config file).

    :

    * you cannot use thin LVM for root and have a normally functioning grub-update system
    * hence, you also cannot use thin LVM for boot partition
    * if your root is also your boot, that means grub won't be able to read boot files from your /boot if root is thin

    * you CAN use thin LVM for everything other than root (grub won't complain about other mounted partitions)
    * only boot and root are excluded.

    Comment


      #3
      Soooooo...... what is a thinly-provisioned LVM, and what would it's use case be?
      (And yes, I did search for it. Still not clear on it)
      A brief summary of what it is and what it is used for may make it more useful to the readers.

      Comment


        #4
        See https://www.kernel.org/doc/Documenta...ovisioning.txt
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Yes, I have already read that, and it still makes little sense.

          There was a post in recent months asking a question about thin provisioning, but it received zero response, possibly due to lack of anyone knowing anything about the topic.

          A brief description of what this is, how why and where it is used would be very useful for a posting in our how-to section.

          Sent from my LG G4

          Comment


            #6
            Then maybe https://access.redhat.com/documentat...d_volumes.html
            Using Kubuntu Linux since March 23, 2007
            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

            Comment

            Working...
            X