install pve on usb raidz0

  1. fix zfs

    /sbin/modprobe zfs

  2. update repository list

    nano /etc/apt/sources.list

    add debhttp://download.proxmox.com/debian/pvestretch pve-no-subscription

    apt-get update

    apt-get upgrade -y

    shutdown -r 0 #reboot

  3. 設定 zfs

  4. ls /dev/disk/by-id # disk id

  5. zpool create -f storage raidz2 [disk-id]

  6. zpool create -f storage raidz2 ata-HGST_HUS726040ALE610_K4HATTSB ata-HGST_HUS726040ALE610_K4HATTYB ata-HGST_HUS726040ALE610_K4HAU4JB ata-HGST_HUS726040ALE610_K4HAU5LB ata-HGST_HUS726040ALE610_K4HNNGLB ata-HGST_HUS726040ALE610_K4HPBS2B ata-HGST_HUS726040ALE610_NHGLT09Y ata-HGST_HUS726040ALE610_NHGLUNRY

  7. 避免usb 大量讀寫

    zfs create storage/var

    mkdir /storage/var/log

    cp -rp /var/log/* /storage/var/log/

    mv /var/log /var/log.bak

    ln -s /storage/var/log /var/log

    mkdir /storage/var/cache

    cp -rp /var/cache/* /storage/var/cache/

    mv /var/cache /var/cache.bak

    ln -s /storage/var/cache /var/cache

    mkdir /storage/var/lib

    mkdir /storage/var/lib/vz

    cp -rp /var/lib/vz/* /storage/var/lib/vz/

    mv /var/lib/vz /var/lib/vz.bak

    ln -s /storage/var/lib/vz /var/lib/vz

    zfs create -V 32G -b $(getconf PAGESIZE) -o compression=zle -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false storage/swap

    mkswap -f /dev/zvol/storage/swap

    echo /dev/zvol/storage/swap none swap defaults 0 0 >> /etc/fstab

    swapon -av zfs destroy rpool/swap

  8. 把/etc/fstab 裡面的 swap 給 comment 掉

  9. 安裝完成後以 USB隨身碟開機會在開機過程中卡住中斷,原因是因為以usb 開機時系統載入的速度較快,而此時系統尚未載入usb driver ,導致找不到 usb隨身碟上的 zfs rpool 分割區而無法正常開機,所以要在/boot/grub/grub.cfg的內容加上 rootdelay=20,再重開測試就可以正常開機,而加入這個指令是先延遲20秒的時間讓系統先載入 usb driver 後再載入 開機系統

  10. zfs create storage/share

    zfs create storage/share/iso

    zfs create storage/vmstorage

    zfs create storage/vmstorage/limited

    zfs set quota=1000G storage/vmstorage/limited

    zfs list

    zpool status

    zpool iostat -v

  11. in GUI

    Click on

    "Datacenter"

    "Storage"

    "Add"

    "Directory"

    `ID: iso`
    
    `Directory: /storage/share/iso`
    
     `Content: make sure only "ISO image" and "Container template" are selected.`
    
    `"Add"`
    
    And again...
    
     `"Add"`
    
     `"ZFS"`
    
     `ID: vmstorage`
    
    `ZFS Pool: /storage/vmstorage`
    

    And again...

    `"Add"`
    
     `"ZFS"`
    
     `ID: vmstoragelimited`
    
     `ZFS Pool: /storage/vmstorage/limited`
    
     `"Add"`
    
  12. 支援 samba ad 下面的 ACL

    zfs set acltype="posixacl" storage

#############################################################

彩色終端

when you run the following command in terminal

eval `dircolors /path/to/dircolorsdb`

The stored database is loaded andlsoutput colors changes accordingly. If you close the existing terminal it will not be available anymore. To make the change permanent.

  • Create a file ~/.dir_colors
  • Copy the color database file (that you want to apply) in it.
  • Add the following command at the end of ~/.bashrc .
eval `dircolors ~/.dir_colors`
  • Source ~/.bashrc using the command in terminal
source ~/.bashrc

It will activate the theme for all future shell sessions.

配色找 solarized

#############################################################

mount -t proc none /storage/vmstorage/limited/subvol-100-disk-1/proc/

mount --rbind /dev/ /storage/vmstorage/limited/subvol-100-disk-1/dev/

mount --rbind /sys/ /storage/vmstorage/limited/subvol-100-disk-1/sys/

chroot /storage/vmstorage/limited/subvol-100-disk-1/ /bin/bash

zpool status

zfs list

results matching ""

    No results matching ""