EPYC MZ32-AR0 MoBo install ubuntu20 Server with LVM

Linux Logical Volume Manager (LVM)

LVM-basic-structure
  • Physical Volume is the disk, like ssd or HD disks.
  • Volume group is the virtual volume, a virtual combination of several disks
  • Logical volume is like \, \Home
  • File system is like ext4 or exFat

System Installation

Connect to BMC

Connect the Server Management LAN Port for server management and one RJ-45 LAN Port for enternet connection.

enter the ip address of Server Management LAN Port on WebBrowser

Web Console

The default username and password is admin and password

However, some MoBo's password are unique. You can find it on the sticker of MoBo like below. The string within the red frame is the password.

pasword location

BMC Unique Pre-Programmed Password Reference Guide ZH EN

Some MoBo have issues with their VGA output, and mine is one of them. So we can login to the server management and Click Remote Control -> Launch H5Viewer to access the vedio output via enternet.

Update Bios

If current bios version is out of date, it might have some issues installing the system, so we can update the bios first.

MZ32-AR0-rev1.0 bios download

Click Maintenance -> Firmware Update -> Select Firmware Image , upload the .rbu image file under the RBU folder of the downloaded zip file. Once uploaded the bios file, we have to click Update again to start flashing.

Install the system

Open the KVM and start installation

configure keyboard
configure ethernet
just pass
click done as default
change the default size of the logical volume from 100G to 1.5T (depending on your disk volume)
continue
Install OpenSSH server
installing
remove the uefi usb
installation complete

Expanding a Filesystem

Physical Volume

Watch the disks

1
lsblk

Create a physical volume (wipping out your entire filesystem on sda)

1
2
sudo pvcreate /dev/sda
sudo pvdisplay

We can now see:

1
2
3
4
5
6
7
8
9
10
11
"/dev/sda" is a new physical volume of "<7.28 TiB"
--- NEW Physical volume ---
PV Name /dev/sda
VG Name
PV Size <7.28 TiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID

Volume Group

Add to a existing VG

Show existing volume groups

1
sudo vgdisplay

Add it to ubuntu-vg

1
sudo vgextend ubuntu-vg /dev/sda

Create a new VG

1
sudo vgcreate hdd-vg /dev/sda

show information

1
sudo vgdisplay

Logical Volume

Create a new LV

In Linux's Logical Volume Manager (LVM), the path to a logical volume is usually specified by names for the volume group and logical volume. In your example, the volume group is named hdd-vg and the logical volume is named hdd-lv. When you create a logical volume, its device path is typically /dev/hdd-vg/hdd-lv.

However, when you use /dev/mapper/hdd--vg-hdd--lv in the command to format the logical volume, this naming convention is due to LVM's configuration and Linux device mappings. The /dev/mapper directory contains special files for logical volumes, with the following naming rules:

  1. Double hyphens (--) replace a single hyphen (-) between the volume group name and the logical volume name.
  2. Double hyphens are also used as separators between the volume group and logical volume names.

Thus, when you specify /dev/mapper/hdd--vg-hdd--lv, the system actually recognizes it as the logical volume at /dev/hdd-vg/hdd-lv. Linux and LVM parse the device name in this way to ensure correct handling, even if the volume group or logical volume names contain hyphens. Therefore, your command indeed targets the logical volume you created at /dev/hdd-vg/hdd-lv.

1
sudo lvcreate hdd-vg -L 2T -n hdd-lv

Format it with ext4

1
sudo mkfs.ext4 /dev/hdd-vg/hdd-lv

Mount the lv

1
2
sudo mkdir -p /mnt/hdd
sudo mount /dev/hdd-vg/hdd-lv /mnt/hdd

Auto mount, copy the UUID:

1
sudo blkid /dev/hdd-vg/hdd-lv

backup the fstab

1
cp /etc/fstab /etc/fstab.bk

unmount the vg

1
sudo umount /mnt/hdd
1
sudo vim /etc/fstab
1
UUID=****	/mnt/hdd	ext4	defaults	0	2

Test

1
2
sudo mount -a
df -h

Rename LV

1
sudo lvrename vg_name old_lv_name new_lv_name

Delete a LV

  1. First umount your lv

    1
    sudo umount /mnt/myvolume
  2. Use lvremove to delete logical volumn

    1
    sudo lvremove /dev/<volume_group_name>/<logical_volume_name>

Increase the size of existing LV

One Volume Group may contians multiple Logical Volumes which usable space is felixible

Now the Logical Volume see in the Filesystem is /dev/mapper/ubuntu--vg-ubuntu--lv

Allocate space

  • Add 10G

    1
    2
    sudo lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv
    sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
  • Add ALL

    1
    sudo lvextend --resizefs -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

Reduce the size of existing LV

  1. Umount your file system
1
sudo umount /mnt/hdd
  1. Reduce the size of the file system to your desired size
1
sudo resize2fs /dev/hdd-vg/hdd-lv 5T
  1. Check file system
1
sudo e2fsck -f /dev/hdd-vg/hdd-lv
  1. Reduce the size of logical volume to your desired size
1
sudo lvreduce -L 2048G /dev/vg_name/lv_name

LVM Snapshots

Create

1
sudo lvcreate /dev/mapper/hdd--vg-hdd--lv -L 4T -s -n hdd-lv_snapshot_202406160000

Restore

Mount a snapshot

fetch the file from the mount point

1
2
3
sudo mkdir /mnt/hdd_snapshot
sudo mount /dev/mapper/hdd--vg-hdd--lv_snapshot_20240616 /mnt/hdd_snapshot

Restore a snapshot

Umount it

1
sudo umount /mnt/hdd
1
sudo lvconvert --merge /dev/mapper/hdd--vg-hdd_snapshot_20240616 

Deactivate the logical volume and re-activate it

1
2
3
sudo lvchange -an /dev/mapper/hdd--vg-hdd--lv
sudo lvchange -ay /dev/mapper/hdd--vg-hdd--lv
sudo mount -a
1
sudo lvs