Results 1 to 9 of 9

Thread: LVM help

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Beans
    7

    LVM help

    I have installed Ubuntu 10.04.3 and did LVM2 from the install -- basically let it make it all.

    Here my output of df -h:

    root@server1:~# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/server1-root
    396G 1.5G 375G 1% /
    none 1000M 248K 1000M 1% /dev
    none 1005M 0 1005M 0% /dev/shm
    none 1005M 284K 1005M 1% /var/run
    none 1005M 0 1005M 0% /var/lock
    none 1005M 0 1005M 0% /lib/init/rw
    none 396G 1.5G 375G 1% /var/lib/ureadahead/debugfs
    /dev/sda1 228M 33M 184M 15% /boot

    And fdisk -l:


    root@server1:~# fdisk -l

    Disk /dev/sda: 438.0 GB, 437998583808 bytes
    255 heads, 63 sectors/track, 53250 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00097deb

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 32 248832 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 32 53251 427481089 5 Extended
    /dev/sda5 32 53251 427481088 8e Linux LVM

    Basically, I've not messed with LVM much and thought I'd give it a try. What I want is to mount /home with most of the half terabyte of space, giving the rest to / about 15gb I figure will do for /

    I'm reading lvm guides. So, first step is to reduce / and then make a new partition I assume to mount /home on.

    How do I go about reducing the size of /?

    lvreduce will kill the data already there.

    Thx.

  2. #2
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: LVM help

    This says you can do it without data loss, from a live mode of course.
    http://blog.shadypixel.com/how-to-sh...volume-safely/

    Note that if using ubuntu desktop cd for live mode, you will need to install lvm2 first and probably scan for the PV and VG to make sure they are recognized:

    sudo apt-get install lvm2
    sudo pvscan
    sudo vgscan

    As for separating /home from / and moving it, I guess you have found some guides since you didn't ask anything about that. I have no idea if it's easy or difficult.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  3. #3
    Join Date
    Apr 2011
    Beans
    7

    Re: LVM help

    Ah very good. Should have googled harder.

    I have lvm2 already I believe:

    lvm version:
    LVM version: 2.02.54(1) (2009-10-26)
    Library version: 1.02.39 (2009-10-26)
    Driver version: 4.15.0

    No no. I need all the help I can get. I'm just getting started

    Moving home should be no big deal since this is a new server doing nothing.

    Normally, I would just start over and do it all from install and not use lvm at all. I just wanted to give it a chance. From what I've read, it can be a good thing, although, some people have complained about it being too complex in a disaster....

  4. #4
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: LVM help

    You misunderstood me. You do have lvm2 installed on the server. However, shrinking root '/' can't be done while it's mounted. So you can't simply boot your server from the HDD.

    To make it easier, you might as well use a ubuntu desktop cd (live cd) and boot it in live mode with Try Ubuntu. That way it's running from the cd and the HDD root is not mounted.

    But the desktop cd doesn't have lvm2 included so you need to install it with that command so it can work with LVM partitions. That install in live mode is temporary, the next time you boot in live mode it won't be there.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  5. #5
    Join Date
    Apr 2011
    Beans
    7

    Re: LVM help

    Ah ok I gotcha. Yes I realize it must be done with root not mounted.

    That page you sent is great. Reading it now.

    Thanks much. I'm still up for any advice however....

  6. #6
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: LVM help

    This looks like a procedure to move Home to a partition /home.
    https://help.ubuntu.com/community/Pa...ng/Home/Moving

    In your case you will have to create an ext4 LV in your LVM, after you shrink the root LV.

    This has some more detailed info about LVM in Ubuntu:
    http://www.howtogeek.com/howto/40702...ent-in-ubuntu/

    Note that you already have a Physical Volume and Volume Group. You only need to create new Logical Volume in the free space created after you shrink the root LV.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •