Ubuntu 18.04 Создаём LVM2 - HDD+SSD на Odroid-H2

конфигурирование (установка и настройка дистрибутивов GNU/Linux, программного обеспечения и др.)
Ответить
Аватара пользователя
Роман Торопов
Администратор
Сообщения: 134
Зарегистрирован: 24 мар 2008, 10:49
Откуда: г. Пермь
Контактная информация:

Ubuntu 18.04 Создаём LVM2 - HDD+SSD на Odroid-H2

Сообщение Роман Торопов » 06 авг 2019, 07:47

Код: Выделить всё

# References
# https://www.digitalocean.com/community/tutorials/how-to-use-lvm-to-manage-storage-devices-on-ubuntu-18-04
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773731
# http://man7.org/linux/man-pages/man7/lvmcache.7.html
# http://strugglers.net/~andy/blog/2017/07/19/bcache-and-lvmcache/
# https://manpages.ubuntu.com/manpages/precise/man8/update-initramfs.8.html
#
# /dev/sda is the big slow hard disk (ada1)
# /dev/sdb is the fast small SSD (sdb1) use 99% for meta 1/1000
sudo apt update
sudo apt install lvm2 thin-provisioning-tools
# view devices supports LVM2
sudo lvmdiskscan
# create storage
sudo pvcreate /dev/sda1 /dev/sdb1
sudo vgcreate storage-vg /dev/sda1
sudo vgextend storage-vg /dev/sdb1
# Let's use the dm-cache based version (write through caching)
sudo lvcreate -n storage-origin-lv -l 100%PVS storage-vg /dev/sda1
sudo lvcreate -n storage-cache-meta-lv -L 512M storage-vg /dev/sdb1
sudo lvcreate -n storage-cache-lv -l 99%FREE storage-vg /dev/sdb1
sudo lvconvert --type cache-pool --poolmetadata storage-vg/storage-cache-meta-lv storage-vg/storage-cache-lv
sudo lvconvert --type cache --cachepool storage-vg/storage-cache-lv storage-vg/storage-origin-lv
sudo mkfs -t ext4 /dev/storage-vg/storage-origin-lv
sudo mount /dev/storage-vg/storage-origin-lv /mnt/storage
# copy UUID device storage from view:
sudo blkid /dev/storage-vg/storage-origin-lv
sudo vi /etc/fstab
# insert new line storage-origin-lv as UUID device, paste from "blkid"
UUID=1234-5678-91011 /mnt/storage auto nosuid,nodev,nofail 0 0
# save and exit

# Check all one last time
sudo pvscan
sudo vgscan
sudo lvscan

# Update the initial ram fs so that the LVM2 volume shows up
sudo vgchange -a y storage-vg
sudo update-initramfs -u
sudo reboot
# if not /dev/storage-vg/* then 
sudo vgchange -a y storage-vg

Ответить