You are not logged in.

#1 2021-04-13 15:02:07

caray
Member
Registered: 2021-04-04
Posts: 25

help setting up LVM

i have a laptop with one SSD, but a second one is in the mail. I'd like to setup LVM so that both ssd drives will be treated as one, rather than just have the new drive as a /disk2....

i'm relying on hibernation into a swap file, will that be a problem, if it breaks the swapfile up onto both disks?
does using LVM imply any sort of degradation on my system's performance?

following is my interpretation of the steps i'll need to take to get it setup once my drive arrives, any comments would be welcome.


-- create the physical volumes:
pvcreate /dev/nvme0n3, which is root's partition on my first drive
and do it again on my second drive once its installed

-- create the volume group:
vgcreate MyVolGroup /dev/nvme0n3 /dev/nvme1n1 (or whatever the second drives partition will be caleld)

-- activate volume group:
vgchange -a y MyVolGroup


and from here im confused, do i need to mess with logical volumes? is this not enough?
my systems already setup with like /etc/fstab and ext4, i created a partition table with gdisk
please help

Offline

#2 2021-04-15 21:23:35

caray
Member
Registered: 2021-04-04
Posts: 25

Re: help setting up LVM

anybody?

Offline

#3 2021-04-16 12:01:25

CarbonChauvinist
Member
Registered: 2012-06-16
Posts: 413
Website

Re: help setting up LVM

caray wrote:

does using LVM imply any sort of degradation on my system's performance?

https://wiki.archlinux.org/index.php/LVM#Disadvantages

caray wrote:

and from here im confused, do i need to mess with logical volumes? is this not enough?
my systems already setup with like /etc/fstab and ext4, i created a partition table with gdisk
please help

Please re-read the LVM wiki.

Yes you need to create logical volumes to go in your volume groups. You then can format the logical volumes withwhatever filesystem you want (i.e. ext4 or btrfs etc.) and then mount those logical volumes in your fstab to the desired mount points. I only have one disk as shown pasted below, in addition to the re-reading the wiki, this should provide a guide point moving forward.

~ $ sudo pvs
  PV             VG  Fmt  Attr PSize    PFree
  /dev/nvme0n1p2 nvg lvm2 a--  <200.00g <25.00g
                                                                                                                                                                                               [ 0s | 16.00:03:48 ]
~ $ sudo vgs
  VG  #PV #LV #SN Attr   VSize    VFree
  nvg   1   2   0 wz--n- <200.00g <25.00g
                                                                                                                                                                                               [ 0s | 16.00:03:58 ]
~ $ sudo lvs
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home nvg -wi-ao---- 125.00g
  root nvg -wi-ao----  50.00g
                                                                                                                                                                                               [ 0s | 16.00:04:30 ]
~ $ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>

# /dev/mapper/nvg-root
UUID=4d59661c-0a7e-41ce-8d7b-6cdb367f6e91       /               ext4            rw,relatime     0 1

# /dev/mapper/nvg-home
UUID=dfbfa78a-e802-42a8-ac80-bbbc155c4a8b       /home           ext4            rw,relatime     0 2

# /dev/nvme0n1p1
UUID=58B8-7868          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro       0 2

# /dev/nvme0n1p3
UUID=1c5bc919-96eb-49e4-abaf-a990b1452147       none            swap            defaults        0 0

# /tmp explicitly set size > 50% default
tmpfs                   /tmp            tmpfs           rw,nodev,nosuid,size=12G                0  0

~ $ lsblk -f
NAME         FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
nvme0n1
├─nvme0n1p1  vfat        FAT32          58B8-7868                               933.4M     9% /boot
├─nvme0n1p2  LVM2_member LVM2 001       bdHyrn-FiMV-kDuo-4WIY-Wcje-Lo40-fkDY8Q
│ ├─nvg-root ext4        1.0            4d59661c-0a7e-41ce-8d7b-6cdb367f6e91      7.5G    79% /
│ └─nvg-home ext4        1.0            dfbfa78a-e802-42a8-ac80-bbbc155c4a8b       37G    65% /home
└─nvme0n1p3  swap        1              1c5bc919-96eb-49e4-abaf-a990b1452147                  [SWAP]

Last edited by CarbonChauvinist (2021-04-16 12:07:48)


"the wind-blown way, wanna win? don't play"

Offline

#4 2021-04-16 12:09:51

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: help setting up LVM

not sure if I understand your question correctly, but do note that pvcreate vgcreate etc. won't preserve your existing data

also if you treat 2 drives as 1 drive (one big filesystem), you would likely lose all data if one drive dies

Last edited by frostschutz (2021-04-16 12:11:37)

Offline

#5 2021-04-16 14:52:10

CarbonChauvinist
Member
Registered: 2012-06-16
Posts: 413
Website

Re: help setting up LVM

Excellent points @frostschutz. More than likely OP would want to simply add in the new PV to the already existing VG and go from there.

Also re: OP's  question about performance, snapshots do affect performance from everything I've read. Here's a thread that discusses some of this, though old -- it may be useful.


"the wind-blown way, wanna win? don't play"

Offline

#6 2021-04-16 17:54:54

caray
Member
Registered: 2021-04-04
Posts: 25

Re: help setting up LVM

no no i dont even have LVM installed yet. To be clear, this is going to require a reinstallation of arch? That's doable. I just thought LVM was something built on top of ext4, not requiring formatting and the associated data loss that happens. So LVM setup is something that starts in the installation process? I dont even want snapshot functionality if it can be turned off? My only goal is to have two drives treated as one.

Last edited by caray (2021-04-16 17:56:42)

Offline

#7 2021-04-17 07:26:55

flyingscorpio
Member
Registered: 2020-06-04
Posts: 34

Re: help setting up LVM

caray wrote:

To be clear, this is going to require a reinstallation of arch? That's doable. I just thought LVM was something built on top of ext4, not requiring formatting and the associated data loss that happens.

See it as replacing your partitions.
If you're setting up LVM on drives where Arch is not installed, like data drives, you won't need to reinstall Arch. But LVM is an abstraction of your drives, you then format your logical volumes, just like you format your partitions. ext4 goes on top of LVM not the other way around, so if you set up LVM on a drive where you have Arch installed, you will loose your data when formating the volume, and you'll reinstall Arch.

Offline

Board footer

Powered by FluxBB