Results 1 to 7 of 7

Thread: How to use LVM volume?

  1. #1
    Join Date
    May 2019
    Beans
    3

    How to use LVM volume?

    I let the new Ubuntu Server installation automatically install with LVM. Mistake. The 2TB drive is all one physical volume (PV) and one Volume Group (VG) (ubuntu-vg) with just a tiny Boot volume and a root volume, ubuntu-lv. New to LVM, I read about it and resized the system volume to 25GB. Then I created a Storage volume of 1.0 TB.

    The system is at /dev/mapper/ubuntu--vg-ubuntu--lv. Everything under / is accessibly normally.
    My data volume lists as /dev/ubuntu-vg/Storage. I cannot access this in any way, but it shows on lvdisplay, etc.

    How do I mount this volume so I can use it for data storage on the server and access it on the network from my other linux machines? I find nothing about that, and my experience with previous partitioning doesn't help much. The server is command line only.

    Thank you.
    Les

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

    Re: How to use LVM volume?

    Where ever you would put /dev/sdaX in the fstab, put the path to the new LVs you've created.

    Here's one of mine:
    Code:
    UUID=d62de6a2-5b69-4d3a-8a31-91040d274d9e /boot ext2 defaults,noatime     0  2
    UUID=E7E6-D023  /boot/efi       vfat    umask=0077      0       1
    /dev/mapper/ubuntu--vg-root /       ext4  noatime,errors=remount-ro 0  1
    /dev/mapper/ubuntu--vg-home--lv /home   ext4 errors=remount-ro,noatime 0 2
    /dev/mapper/ubuntu--vg-stuff    /stuff  ext4 errors=remount-ro,noatime 0 2 
    /dev/mapper/ubuntu--vg-swap_1   none      swap    sw              0       0
    Learn to use the 3 different layers in LVM
    * PV (also called PEs)
    * VGs
    * LVs

    lvs, vgs, pvs are handy commands to get sorter output than pvdisplay, vgdisplay, lvdisplay.
    Also, most LV commands to extend or reduce LV sizes can deal with EXT4 file systems at the same time. Other file systems will need to be handled separately.

    Clear as mud?

    LVM provides so much flexibility that you'll learn to love it, I'm certain. Do not allocate all the VG storage. Add it as needed, so you have a few weeks warning before the VG is totally used and need to either buy a larger disk or add more storage as PVs which can be used to extend the VG, making more room for LVs.

    And when it is time to move to new storage, you'll be extremely happy to have LVM, since it makes moving to new storage trivial.
    Last edited by TheFu; May 3rd, 2019 at 11:51 PM.

  3. #3
    Join Date
    May 2019
    Beans
    3

    Re: How to use LVM volume?

    The Fu,
    thanks for the help. I tried this at the command line, checking the case and spelling, etc:
    sudo mount /dev/mapper/ubuntu--vg-Storage /storage ext4 0 2
    This returned "mount: bad usage. . ."
    I do have the /storage folder and it is empty. It is not capitalized, and the mapper version of the volume is capitalized. The Storage volume appears in lsblk as and "lvm" just like ubuntu-lv, the system partition.

    I didn't mess with fstab since I should be able to mount it from the command line at least temporarily to check. Right?
    ideas?
    Les.

  4. #4
    Join Date
    Mar 2007
    Beans
    468

    Re: How to use LVM volume?

    Typically you should only need this command to mount a file system:
    Code:
    $ sudo mount /dev/mapper/ubuntu-vgStorage /storage
    Assuming there really is a device named /dev/mapper/ubuntu-vgStorage

    If you need to add the filesystem type to the mount command you use the -t switch something like:

    Code:
    $ sudo mount -t ext4  /dev/mapper/ubuntu-vgStorage /storage
    The line you would put in the /etc/fstab file would be something like:

    Code:
    #[Device]                       [Mount Point]       [File System Type]      [Options]       [Dump]       [Pass]
    /dev/mapper/ubuntu-vgStorage    /storage            ext4                    defaults         0            2

  5. #5
    Join Date
    May 2019
    Beans
    3

    Re: How to use LVM volume?

    Thanks, guys, but I'm giving up. Not something I like to do. The inconsistencies or complexities of the LVM have worn me down. Is it ubuntu--vg or ubuntu-vg? If my prompt shows /storage# when I'm there, why doe "mounting point does not exist" when I try to mount to /storage?
    Thanks again for trying.

  6. #6
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How to use LVM volume?

    Quote Originally Posted by lbunch View Post
    Thanks, guys, but I'm giving up. Not something I like to do. The inconsistencies or complexities of the LVM have worn me down. Is it ubuntu--vg or ubuntu-vg? If my prompt shows /storage# when I'm there, why doe "mounting point does not exist" when I try to mount to /storage?
    Thanks again for trying.
    I agree with your approach. I do have one partition/install on LVM and it's great for tinkering because I can revert to previous snapshots, but that's only one partition of three. The other two are standard and what I rely on for my base system. My advice would be to keep your base install as simple, standard and default as possible. Then do stuff like LVM on a separate partition after you have learned the ropes and are comfortable finding your way around in the CLI.

    Good Luck and Happy Ubuntu'n!

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

    Re: How to use LVM volume?

    Quote Originally Posted by lbunch View Post
    Thanks, guys, but I'm giving up. Not something I like to do. The inconsistencies or complexities of the LVM have worn me down. Is it ubuntu--vg or ubuntu-vg? If my prompt shows /storage# when I'm there, why doe "mounting point does not exist" when I try to mount to /storage?
    Thanks again for trying.
    Hopefully, you haven't moved on.

    Storage devices make use of symbolic links. If you understand those, then continue reading. If not, best to hop out to wikipedia and read a few paragraphs about them. Symbolic links are handy for many things on Unix systems. We use them all the time. They make directories or files located in convenience locations, even when they have to be located somewhere else, less convenient.

    The full path to the device is on your computer. Storage devices are always under /dev/ somewhere.
    On my 16.04 system, LVM LVs are mapped under /dev/mapper.
    Code:
    /dev/mapper$ ls -alF
    will show the /dev/mapper/{name} you want to use. With those ls options, you'll see where the symbolic links actually point ... to the device-mapper "devices".

    For non-LVM devices, you can find similar storage links under /dev/disk/
    Code:
    $ ls -F
    by-id/  by-partlabel/  by-partuuid/  by-path/  by-uuid/
    If you do a
    Code:
    find /dev/disks -ls
    You'll see all the different possible device links by id, label, UUID and paths. For more complex stores setups, I prefer to use by-path/ devices. Those don't change without physically modifying cables, cards, and disks.

    Why do we use this level of indirection? Wouldn't pointing at /dev/sda5 be much easier? In the old days we did it that way, but as more storage, more partitions, became common, and different parts of the Linux boot sequence became parallelized, the different partitions and disks would be discovered in different order, so from boot to boot, sda , sdb, sdc, sde, sd ..... z order would change. To solve that, someone decided that making UUIDs, which are tied to each partition, would be better. This is the default for new installs of Linux and has been for about 15 yrs. It solved the issue, but it is hardly intuitive.

    The format for fstab is very different than the format for a CLI/shell mount command. You did check out the manpage for each, right?

Tags for this Thread

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
  •