Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: LVM on existing system

  1. #1
    Join Date
    Aug 2006
    Location
    Stockholm, Sweden
    Beans
    Hidden!

    LVM on existing system

    I have Ubuntu 18.04.3 LTS on a Samsung SSD EVO 960 and have used the entire disk when I install Ubuntu.
    Now I am running out of space and want to add another SSD and also take advantage of LVM.
    My question is if I can use the existing disk to install LVM without destroying data and after that include the new SSD.
    I have as follows:

    ~$ ls -la /dev/nvme0*
    crw------- 1 root root 240, 0 dec 2 11:45 /dev/nvme0
    brw-rw---- 1 root disk 259, 0 dec 2 12:07 /dev/nvme0n1
    brw-rw---- 1 root disk 259, 1 dec 2 12:07 /dev/nvme0n1p1
    brw-rw---- 1 root disk 259, 2 dec 2 12:07 /dev/nvme0n1p2

    ~$ df
    Filesystem 1K-blocks Used Available Use% Mounted on
    udev 15376396 0 15376396 0% /dev
    tmpfs 3086696 1492 3085204 1% /run
    /dev/nvme0n1p2 238798492 151905908 74692548 68% /
    tmpfs 15433472 69540 15363932 1% /dev/shm
    tmpfs 5120 4 5116 1% /run/lock
    tmpfs 15433472 0 15433472 0% /sys/fs/cgroup
    /dev/nvme0n1p1 523248 6232 517016 2% /boot/efi
    tmpfs 3086692 16 3086676 1% /run/user/1000

    Can I make 'sudo pvcreate /dev/nvme0n1p1' without destroying my boot&system disk /dev/nvme0n1?
    The Truth Is Out There

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    Quote Originally Posted by zkab View Post
    My question is if I can use the existing disk to install LVM without destroying data and after that include the new SSD.
    ....
    Can I make 'sudo pvcreate /dev/nvme0n1p1' without destroying my boot&system disk /dev/nvme0n1?
    No.

    You can setup LVM on the new storage, however.

    OTOH, if your backup and recovery method doesn't allow easily backing up from 1 system and restoring to another, with different storage, networking, CPUs, and motherboard, then I'd say you need a better backup technique.

    But that is just me.

  3. #3
    Join Date
    Aug 2006
    Location
    Stockholm, Sweden
    Beans
    Hidden!

    Re: LVM on existing system

    OK ... so LVM should always be created on new disks ...
    After I started this thread I saw in 'https://wiki.ubuntu.com/Lvm' following:
    'You can install the lvm2 package on an existing system, or the desktop livecd and manually set it up, and then install to it.'
    Doesn't that mean it can be installed on existing systems or have I misunderstood?
    The Truth Is Out There

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    Those are true, but "existing system" doesn't mean the same partitions already used without data being wiped. You have to backup the data, setup the LVM, restore the data.
    Or
    you can have a running system on 1 disk (A), add another disk (B), partition "B", create LVM PVs into 1 or more partitions on "B" and use it that way. All without touching "A". For example,
    Code:
    sdd                                   7.3T disk             
    └─sdd1                                7.3T part LVM2_member 
      ├─istar--8TB-istar--back3--a        3.7T lvm  ext4        /misc/b-D3
      └─istar--8TB-istar--back3--b        3.6T lvm  ext4        /misc/b-D4
    $ sudo vgs
      VG             #PV #LV #SN Attr   VSize   VFree 
      istar-8TB        1   2   0 wz--n-   7.28t 14.03g
    ...
    $ sudo lvs
      LV             VG             Attr       LSize   Pool Origin Data%   
      istar-back3-a  istar-8TB      -wi-ao----   3.65t                                                    
      istar-back3-b  istar-8TB      -wi-ao----   3.62t
    sdd is an 8TB disk.
    sdd1 is a partition that fills the entire disk. It is also a PV.
    istar-8TB is the VG that uses the total PV.
    istar-back3-a and istar-back3-b are the LVs that take storage from the VG, just a little less than everything available. This leaves room for an emergency increase where it is needed just before storage is really all used up.

    Any LVM isn't a "disk" thing. It is a "Partition" thing. Windows people seem to get those confused, because MSFT calls partitions "drives." This is factually incorrect.

  5. #5
    Join Date
    Aug 2006
    Location
    Stockholm, Sweden
    Beans
    Hidden!

    Re: LVM on existing system

    OK ... thanks for your help ... I will study it carefully
    The Truth Is Out There

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    The stuff I posted in this thread was "for example", not any suggestion.

    To do an install so the OS leverages LVM is possible either using the manual setup stuff or just selecting "Use LVM on whole disk" (or something similar). Post install, I immediately shrink the size of the root LV to 25G, create a /home LV (25G to start) and a swap LV (4.1G size), move over any /etc/fstab entries as needed (or not) and remove the swapfile that 18.04 and later use. With this basic setup, I'm ready to add more LVs where desired or increase existing LVs as needed, on-demand. For some server-only machines that will never have user accounts, I won't bother with a separate HOME LV/partition. It isn't worth the hassle when there aren't any users. All the "data" for those systems are stored elsewhere.

    Don't forget to leave room for LVM snapshots, so clean backups can use snapshots. For some systems, 1G is plenty, but others might need 10G or 100G - just depends on the amount of data changing while backups are happening. Often times, we forget to mention this.

    lsblk -o name,size,type,fstype,mountpoint is an extremely handy command. I've made it an alias.
    Same for df -hT - much better than a straight df.
    Obviously, use pvs, vgs, lvs to get summary of LVM setups, but still need the lsblk alias above.

  7. #7
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,782
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    @TheFu

    Just curious if this strategy is the best when thinking forward. Although LVM isn't going away, Ubuntu is moving toward ZFS. ZFS has ability to create pools spanning several disks and has its own method of creating snapshots. The only problem at this moment with using ZOL, is that it cant encrypt root since bootloader isn't capable of decrypting during startup. Bootloaders at this point can decrypt LVM encrypted partitions at the time of boot. I'm just wondering your position on possibly recommending use of ZFS over LVM in terms of "future-proofness", particularly if user is going to start-over.

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    I work with what we have today. The future is unknown until 6 months after a stable release happens. When it comes to data, I'm extremely risk-adverse. Data is more important than hardware. If I lose all my computers, it would suck, but as long as the data were available somewhere, it isn't the end of the world. OTOH, without the data, what's the point of having any computer?

    For someone new like the OP, trying to mix both LVM and ZFS could be confusing. LVM will be used on boot and OS parts of systems for the foreseeable future. ZFS on the data parts. Eventually, ZFS will be the default, except on purpose built or constrained systems.

    I want to see how well the upgrade process works for ZFS booted systems. I'm hopeful, but want to see it working first, across thousands of other-people's-systems. My systems aren't for debugging issues. I did that in the 1990s. No more. Stuff that is proven to work and all the hassles are understood is what I want. For OS areas, LVM has that, ZFS does not.

    IMHO.

    I ran JFS for years after ext3 was available and only switched to ext4 around 5 yrs after it was the standard. I completely expect it to become THE DEFAULT file system and volume management across all non-constrained Linux systems. It has been the detail solution for LXD for some years.

  9. #9
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,782
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    @TheFu

    I understand your sentiments. I get the hesitation with ZFS, however this filesystem has been used by oracle and BSD for a long long time. I think the new part is the incorporation of ZFS on root with ZOL within Linux. I get it might not be prime time yet for production systems, however I'm betting OP is running a home based system -- which is ideal for testing. Would be even better if virtualized for testing.

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: LVM on existing system

    Quote Originally Posted by kevdog View Post
    @TheFu

    I understand your sentiments. I get the hesitation with ZFS, however this filesystem has been used by oracle and BSD for a long long time. I think the new part is the incorporation of ZFS on root with ZOL within Linux. I get it might not be prime time yet for production systems, however I'm betting OP is running a home based system -- which is ideal for testing. Would be even better if virtualized for testing.
    Oracle isn't a reference that impresses me. I've dealt with them on a number of projects. The Sun Micro guys were good, but most left. Oracle DBAs are great, if you use Oracle's DBMS. https://www.theregister.co.uk/2019/1...nager_lawsuit/

    I started using ZFS at work around 2006/2007 on Solaris machines. No issues with the Solaris or BSD implementations or the Linux 64-bit implementation for data use. LXD stuff on Ubuntu uses it by default today. It is all solid.

    For larger data storage, ZFS is a viable option, I've just got so much on LVM+ext4 to make switching non-trivial.

    My concern with ZFS is for OS and boot storage only, which is what this thread is mostly about.

    Remember when BTRFS was going to be the new default boot file system? Then Redhat deprecated it and it lost favor across many distros? SuSE is the main distro still using BTRFS, right? I'm a wait-n-see guy.

    There are lots of different solutions to this problem. Only zkab can pick the best answer for the requirements. ZFS for data is definitely a viable option.
    LVM+ext4 is also a viable option.
    ext4 or xfs are also viable options without any volume management.
    Last edited by TheFu; 6 Days Ago at 02:31 AM.

Page 1 of 2 12 LastLast

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
  •