Logical Volume Management on Debian Linux

Page 1 of 212

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Rob Turner

He is an Instructor of Computer Technology with Ball State University where he currently teaches all of the departments Linux courses and co-teaches Cisco networking courses. He is an avid Debian user as well as many of the derivatives of Debian such as Mint, Ubuntu, and Kali. Rob holds a Masters in Information and Communication Sciences as well as several industry certifications from Cisco, EC-Council, and Linux Foundation.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

12 Responses

  1. sekhar says:

    Hi,

    I have reduced the remove the RAID-1 array (/dev/md0) to 48G size and it is configured on the lvm and trying to reduce respective disk space (sda4) as well to 48G from 58G.

    But i am not able to accomplish this, could you please help me regarding this.

    [email protected]~# lsblk
    NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
    sda                       8:0    0 232.9G  0 disk
    ├─sda1                    8:1    0  16.5G  0 part
    └─sda4                    8:4    0    58G  0 part
    └─md0                   9:0    0    48G  0 raid1
    ├─vg0-root (dm-0)   252:0    0  26.6G  0 lvm   /
    ├─vg0-backup (dm-1) 252:1    0  19.6G  0 lvm
    └─vg0-swap (dm-2)   252:2    0   1.9G  0 lvm   [SWAP]
    sr0                      11:0    1  1024M  0 rom
    
    [email protected]~:~# pvdisplay
    --- Physical volume ---
    PV Name               /dev/md0
    VG Name               vg0
    PV Size               48.00 GiB / not usable 3.00 MiB
    Allocatable           yes (but full)
    PE Size               4.00 MiB
    Total PE              12287
    Free PE               0
    Allocated PE          12287
    PV UUID               uxH3FS-sUOF-LsIP-kAjq-7Bwq-suhK-CLJXI1
    
    [email protected]~:~# vgdisplay
    --- Volume group ---
    VG Name               vg0
    System ID
    Format                lvm2
    Metadata Areas        1
    Metadata Sequence No  112
    VG Access             read/write
    VG Status             resizable
    MAX LV                0
    Cur LV                3
    Open LV               2
    Max PV                0
    Cur PV                1
    Act PV                1
    VG Size               48.00 GiB
    PE Size               4.00 MiB
    Total PE              12287
    Alloc PE / Size       12287 / 48.00 GiB
    Free  PE / Size       0 / 0
    VG UUID               LjCUyX-25MQ-WCFT-j2eF-2UWX-LYCp-TtLVJ5
    
    [email protected]~:~# lvdisplay
    --- Logical volume ---
    LV Path                /dev/vg0/root
    LV Name                root
    VG Name                vg0
    LV UUID                SBf1mc-iqaB-noBx-1neo-IEPi-HhsH-SM14er
    LV Write Access        read/write
    LV Creation host, time S000001, 2015-09-23 03:01:19 +0000
    LV Status              available
    # open                 1
    LV Size                26.59 GiB
    Current LE             6808
    Segments               2
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           252:0
    --- Logical volume ---
    LV Path                /dev/vg0/backup
    LV Name                backup
    VG Name                vg0
    LV UUID                E0zuBR-3iIT-ig42-1y2j-YvJY-PMea-P9d8D4
    LV Write Access        read/write
    LV Creation host, time S000001, 2017-02-11 05:30:02 +0000
    LV Status              available
    # open                 0
    LV Size                19.54 GiB
    Current LE             5003
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           252:1
    --- Logical volume ---
    LV Path                /dev/vg0/swap
    LV Name                swap
    VG Name                vg0
    LV UUID                LqeFep-zKvG-vRJI-Id9N-LXmZ-FZlI-fvM040
    LV Write Access        read/write
    LV Creation host, time Microknoppix, 2017-03-02 16:09:29 +0000
    LV Status              available
    # open                 2
    LV Size                1.86 GiB
    Current LE             476
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           252:2
    
    [email protected]~:~# cat /proc/mdstat
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
    md0 : active raid1 sda4[3]
    50331648 blocks super 1.2 [2/1] [U_]
    unused devices: 
    
  2. Dibs says:

    Thank you so much for this how to guide, i’m going to be doing my LFCS soon and was cracking my head to understand LVM and it all clicked while reading this HOW TO. Thank you for the easy to understand write up, you sir I salute.

    • Rob Turner says:

      Dibs,

      You are quite welcome and best of luck on the LCFS. It’s a great test to challenge yourself with common Linux tasks!

  3. Anders says:

    I love LVM2 and software raid in Linux. One tip if you want to try this before making something for real, use USB memory sticks as disks. They work great as such. Swell to test disk craches and rebuilding RAID-5 or RAID-6.

    • Rob Turner says:

      Anders, I prefer LVM on hardware RAID but this little NAS box didnt support HW RAID. The USB drive option is a fantastic idea for testing a potential install! No reason to risk the real drives when USB media is so cheap.

      • Anders says:

        Actually, hardware Raid have hardware dependencies. Linux software Raided disks can be moved between machines, for instance when replace a faulty motherboard or disc controller. That can’t be done securly unless replaced with the same brand and version of hardware.

        By the way, it is dead easy to move a volume group and its logical volumes to new disks and remove old that are about to crach. Just add a physical volume to the volume group and then move all data off the bad one. Lastly remove the bad one. No need to do any manual moving. Used it to move a raid that was degenerated out and a new, larger in.

        Lastly, I would have recommended to mount under /srv and not /mnt. As /mnt are meant for temporary mounts and /srv are for server storage. Makes it easier to backup, like /home for user data. ;-)

        • Rob Turner says:

          Anders, To each their own. /mnt was only used for illustrative purposes. The box that these drives are actually in, does mount the LVM’s in a different location.

  4. satish says:

    Please let me know if the LVM is same for other distro’s as well.

    • Rob Turner says:

      Satish, You’re very welcome. LVM2 is very similar across most distributions. I can’t speak for de facto but I would say that most of the LVM stuff will be the same across distributions. The only realy differences will likely be Distro specific things and maybe naming conventions of the LVM package.

  5. SRN says:

    Great articule!!!!please more on the like of this.
    Thanks

  6. Satish says:

    I am waiting since very long time for this.
    Many Thanks @Rob Turner @Tecmint

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *