# - bof - # # - - # # - Documentation - # https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2022.04%20Root%20on%20ZFS.html # - - # # - Boot on EFI mode - # uServer_23.04(64bit)-ManticMinotaur_2023-08-27_ZFS-Bios uServer_23.04(64bit)-ManticMinotaur_2023-08-27_ZFS-UEFI qemu-img create -f qcow2 -o preallocation=off \ /DataPool/Images/VManager/'uServer_23.10(64bit)-ManticMinotaur_2023-08-27_ZFS-Bios' 30G; qemu-img create -f qcow2 -o preallocation=off \ /DataPool/Images/VManager/'uServer_23.10(64bit)-ManticMinotaur_2023-08-27_ZFS-UEFI' 30G; # :1 # - - # # - Start with UbuntuDesktopDVD / Open terminal - # Boot the Ubuntu Live CD. From the GRUB boot menu, select Try or Install Ubuntu. On the Welcome page, select your preferred language and Try Ubuntu. Connect your system to the Internet as appropriate (e.g. join your WiFi network). Open a terminal (press Ctrl-Alt-T). # :2 # - - # # - Configure root user - # # :2.1 # - - # # - Update & install openssh - # sudo apt update; sudo apt install --yes openssh-server vim; #sudo apt install --yes python3-pip; # :3 # - - # # - Disable automounting - # gsettings set org.gnome.desktop.media-handling automount false; # :4 # - - # # - Become root - # sudo -i; # :4.1 # - - # # - Edit sshd_config file - # vim /etc/ssh/sshd_config; PermitRootLogin yes PasswordAuthentication yes :wq sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config; sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config; # :4.2 # - - # # - Restart ssh service - # systemctl restart ssh; # :4.3 # - - # # - Change root password - # passwd; ip -c a; # :4.4 # - - # # - ssh into the server - # ssh-keygen -R 10.0.0.45 ssh root@10.0.0.45 # :5 # - - # # - Install ZFS in the Live CD environment - # # - - # # - It takes some time to restart - # /usr/sbin/update-initramfs.orig.initramfs-tools; apt install --yes debootstrap gdisk zfsutils-linux; apt clean; apt update; apt install --reinstall python3-pip; apt -f install; systemctl stop zed; swapoff --all; # :6 # - - # # - Format disk - # ls -lah /dev/disk/by-id; lrwxrwxrwx 1 root root 9 Aug 28 15:25 ata-QEMU_DVD-ROM_QM00001 -> ../../sr0 DISK=/dev/disk/by-id/ata-QEMU_DVD-ROM_QM00001; # - - # # - Format VirtualManager use vda - # lsblk -f; DISK=/dev/vda; # :7 # - - # # - See if one or more MD arrays are active - # apt install --yes mdadm; cat /proc/mdstat; # - - # # - If so, stop them (replace ``md0`` as required) - # mdadm --stop /dev/vda; # - - # # - For an array using a partition (e.g. a swap partition per this HOWTO) - # mdadm --zero-superblock --force ${DISK}-part2; # :8 # - - # # - Prepare disk - # lsblk; sgdisk --zap-all /dev/vda; lsblk; # :9 # - - # # - Create bootloader partition(s) - # # :9.1 # - - # # - EFI - # # - Create EFI, BOOT & ROOT partitions - # sgdisk -n2:1M:+512M -t2:EF00 /dev/vda; # EFI partition sgdisk -n3:0:+640M -t3:BF01 /dev/vda; # BOOT sgdisk -n4:0:0 -t4:BF01 /dev/vda; # ROOT lsblk; # :9.2 # - - # # - Bios - # sgdisk -a1 -n5:24K:+1000K -t5:EF02 $DISK; lsblk; # :9.3 # - - # # - Show disks - # ls -lah /dev/disk/by-id; ls -lah /dev/disk/by-path; lsblk; lsblk; NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 144.2M 1 loop /rofs loop1 7:1 0 345.7M 1 loop /tmp/tmps9rimpy0/ubuntu-server-minimal.ubuntu-server.squashfs.dir /media/minimal loop5 7:5 0 345.7M 1 loop /media/full loop6 7:6 0 63.2M 1 loop /snap/core20/1738 sr0 11:0 1 1.6G 0 rom /cdrom vda 252:0 0 30G 0 disk ├─vda2 252:2 0 512M 0 part ├─vda3 252:3 0 640M 0 part └─vda4 252:4 0 28.9G 0 part # :10 # - - # # - Create BOOT POOL (bpool) Zfs partition - # # :10.1 # - - # # - Create BOOT POOL (bpool) Zfs partition - # zpool create -o ashift=12 -d -f \ -o feature@async_destroy=enabled \ -o feature@bookmarks=enabled \ -o feature@embedded_data=enabled \ -o feature@empty_bpobj=enabled \ -o feature@enabled_txg=enabled \ -o feature@extensible_dataset=enabled \ -o feature@filesystem_limits=enabled \ -o feature@hole_birth=enabled \ -o feature@large_blocks=enabled \ -o feature@lz4_compress=enabled \ -o feature@spacemap_histogram=enabled \ -o feature@userobj_accounting=enabled \ -O acltype=posixacl -O canmount=off -O compression=lz4 -O devices=off \ -O normalization=formD -O relatime=on -O xattr=sa \ -O mountpoint=/ -R /mnt \ bpool /dev/vda3; # BOOT Partition # :10.2 # - - # # - Create ROOT POOL (rpool) Zfs partition - # zpool create -o ashift=12 -f \ -O acltype=posixacl -O canmount=off -O compression=lz4 \ -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa \ -O mountpoint=/ -R /mnt \ rpool /dev/vda4; # ROOT Partition # :10.3 # - - # # - Create file systems - # zfs create -o canmount=off -o mountpoint=none rpool/ROOT; zfs create -o canmount=off -o mountpoint=none bpool/BOOT; zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/ubuntu; zfs create -o canmount=noauto -o mountpoint=/boot bpool/BOOT/ubuntu; zfs mount rpool/ROOT/ubuntu; zfs mount bpool/BOOT/ubuntu; zfs create rpool/home; zfs create -o mountpoint=/root rpool/home/root; zfs create -o canmount=off rpool/var; zfs create -o canmount=off rpool/var/lib; zfs create rpool/var/log; zfs create rpool/var/spool; zfs create -o com.sun:auto-snapshot=false rpool/var/lib/docker; zfs create -o com.sun:auto-snapshot=false rpool/tmp; chmod 1777 /mnt/tmp; # :11 # - - # # - Install ubuntu (use ubuntu version) - # # :11.1 # - - # # - Show version - # lsb_release -a; No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu Mantic Minotaur (development branch) Release: 23.10 Codename: mantic # :11.2 # - - # # - Install - # #apt install debootstrap; debootstrap mantic /mnt; mkdir -p /mnt/etc/zfs; cp /etc/zfs/zpool.cache /mnt/etc/zfs/; # :12 # - - # # - Configuring Zfs devices - # zfs set devices=off rpool; # :13 # - - # # - Configuring hostname & hosts - # rm -r /mnt/etc/hostname; echo 'uServerZFS' >> /mnt/etc/hostname; rm -r /mnt/etc/hosts; echo '127.0.0.1 localhost' >> /mnt/etc/hosts; echo '127.0.1.1 uServerZFS' >> /mnt/etc/hosts; echo '' >> /mnt/etc/hosts; echo '::1 localhost ip6-localhost ip6-loopback' >> /mnt/etc/hosts; echo 'ff02::1 ip6-allnodes' >> /mnt/etc/hosts; echo 'ff02::2 ip6-allrouters' >> /mnt/etc/hosts; # :14 # - - # # - Configuring network - # ip -c a; 2: enp1s0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 52:54:00:a0:70:2e brd ff:ff:ff:ff:ff:ff inet 10.0.0.44/24 brd 10.0.0.255 scope global dynamic noprefixroute enp1s0 sNetplanF_=/mnt/etc/netplan/01-netcfg.yaml; rm -rf $sNetplanF_; echo 'network:' >> $sNetplanF_; echo ' ethernets:' >> $sNetplanF_; echo ' enp1s0:' >> $sNetplanF_; echo ' dhcp4: no' >> $sNetplanF_; echo ' addresses: [10.0.0.101/24]' >> $sNetplanF_; echo ' gateway4: 10.0.0.1' >> $sNetplanF_; echo ' nameservers:' >> $sNetplanF_; echo ' addresses: [8.8.8.8, 8.8.4.4]' >> $sNetplanF_; echo ' version: 2' >> $sNetplanF_; cat $sNetplanF_; # vim $sNetplanF_; # network: # ethernets: # enp1s0: # dhcp4: no # addresses: [192.168.122.130/24] # gateway4: 192.168.122.1 # nameservers: # addresses: [8.8.8.8, 8.8.4.4] # version: 2 # :15 # - - # # - Configuring ubuntu /etc/apt/sources.list - # sSourcesF_=/mnt/etc/apt/sources.list; rm -rf $sSourcesF_; echo 'deb http://archive.ubuntu.com/ubuntu mantic main universe' >> $sSourcesF_; echo 'deb-src http://archive.ubuntu.com/ubuntu mantic main universe' >> $sSourcesF_; echo '' >> $sSourcesF_; echo 'deb http://security.ubuntu.com/ubuntu mantic-security main universe' >> $sSourcesF_; echo 'deb-src http://security.ubuntu.com/ubuntu mantic-security main universe' >> $sSourcesF_; echo '' >> /mnt/etc/apt/sources.list; echo 'deb http://archive.ubuntu.com/ubuntu mantic-updates main universe' >> $sSourcesF_; echo 'deb-src http://archive.ubuntu.com/ubuntu mantic-updates main universe' >> $sSourcesF_; cat $sSourcesF_; # vim /mnt/etc/apt/sources.list; # deb http://archive.ubuntu.com/ubuntu lunar main universe # deb-src http://archive.ubuntu.com/ubuntu lunar main universe # deb http://security.ubuntu.com/ubuntu lunar-security main universe # deb-src http://security.ubuntu.com/ubuntu lunar-security main universe # deb http://archive.ubuntu.com/ubuntu lunar-updates main universe # deb-src http://archive.ubuntu.com/ubuntu lunar-updates main universe # :16 # - - # # - Mount & configuring partitions - # mount --rbind /dev /mnt/dev; mount --rbind /proc /mnt/proc; mount --rbind /sys /mnt/sys; chroot /mnt /bin/bash --login; rm -rf /etc/mtab; ln -s /proc/self/mounts /etc/mtab; # :17 # - - # # - Configuring locales, timezone - # apt update; apt install vim nano -y; echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; locale-gen; # dpkg-reconfigure tzdata; # America/New_York # - - # # - Set localtime - # ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime; # - - # # - Set hardware clock - # hwclock --systohc; # :18 # - - # # - Install ubuntu linux kernel, zfs-initramfs & dosfstools - # # :18.1 # - - # # - BIOS - # apt install --yes grub-pc \ linux-image-generic \ zfs-initramfs \ zsys \ dosfstools; # :18.2 # - - # # - EFI - # apt install --yes grub-efi-amd64 \ grub-efi-amd64-signed \ linux-image-generic \ shim-signed \ zfs-initramfs \ zsys \ dosfstools; # :19 # - - # # - Create EFI partition - # lsblk; mkdosfs -F 32 -s 1 -n EFI /dev/vda2; mkdir /boot/efi; ls -lah /dev/disk/by-uuid; echo "UUID=5AE7-6006 /boot/efi vfat nofail,x-systemd.device-timeout=1 0 1" >> /etc/fstab; mount /boot/efi; lsblk; # :20 # - - # # - Set root passwd - # passwd; Administrator2 # :21 # - - # # - Configuring services - # sZfsServices_=/etc/systemd/system/zfs-import-bpool.service; rm -rf $sZfsServices_; echo '[Unit]' >> $sZfsServices_; echo 'DefaultDependencies=no' >> $sZfsServices_; echo 'Before=zfs-import-scan.service' >> $sZfsServices_; echo 'Before=zfs-import-cache.service' >> $sZfsServices_; echo '' >> $sZfsServices_; echo '[Service]' >> $sZfsServices_; echo 'Type=oneshot' >> $sZfsServices_; echo 'RemainAfterExit=yes' >> $sZfsServices_; echo 'ExecStart=/sbin/zpool import -N -o cachefile=none bpool' >> $sZfsServices_; echo '' >> $sZfsServices_; echo '[Install]' >> $sZfsServices_; echo 'WantedBy=zfs-import.target' >> $sZfsServices_; cat $sZfsServices_; # vim /etc/systemd/system/zfs-import-bpool.service; # [Unit] # DefaultDependencies=no # Before=zfs-import-scan.service # Before=zfs-import-cache.service # [Service] # Type=oneshot # RemainAfterExit=yes # ExecStart=/sbin/zpool import -N -o cachefile=none bpool # [Install] # WantedBy=zfs-import.target # - - # # - Enable services - # systemctl enable zfs-import-bpool.service; cp /usr/share/systemd/tmp.mount /etc/systemd/system/; systemctl enable tmp.mount; # :4.1 # - - # # - Edit sshd_config file - # apt install --yes openssh-server; vim /etc/ssh/sshd_config; PermitRootLogin yes PasswordAuthentication yes :wq sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config; sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config; # :4.2 # - - # # - Restart ssh service - # #systemctl restart ssh; # - - # # - Setup system groups - # addgroup --system lpadmin; addgroup --system lxd; addgroup --system sambashare; # - - # # - Check grub - # grub-probe /boot; update-initramfs -u -k all; # - - # # - Edit grub file - # vim /etc/default/grub; GRUB_DEFAULT=0 GRUB_TIMEOUT_STYLE=hidden GRUB_TIMEOUT=5 GRUB_RECORDFAIL_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="root=ZFS=rpool/ROOT/ubuntu" GRUB_CMDLINE_LINUX="" GRUB_TERMINAL=console # - - # # - Update grub - # update-grub; grub-install --target=x86_64-efi --efi-directory=/boot/efi \ --bootloader-id=ubuntu --recheck --no-floppy; # - - # # - List zfs.mod - # ls -lah /boot/grub/*/zfs.mod; lsblk; umount /boot/efi; # - - # # - Create /fstab - # vim /fstab; bpool/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 rpool/var/log /var/log zfs nodev,relatime 0 0 rpool/var/spool /var/spool zfs nodev,relatime 0 0 rpool/tmp /tmp zfs nodev,relatime 0 0 # - - # # - Set mount points - # zfs set mountpoint=legacy bpool/BOOT/ubuntu; zfs set mountpoint=legacy rpool/var/log; zfs set mountpoint=legacy rpool/var/spool; zfs set mountpoint=legacy rpool/tmp; # - - # # - Create snapshot - # zfs snapshot bpool/BOOT/ubuntu@install; zfs snapshot rpool/ROOT/ubuntu@install; exit; mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {}; cd /; zpool export -a; sudo shutdown now; reboot; # - - # # - Install zfs - # sudo apt install zfsutils-linux -y; :Option 1 # - - # # - Create zfs pools by /dev/sdb /dev/sdc, etc; - # :a # - - # # - Create mirror pools - # :a.1 # - - # # - USBs - # sudo zpool create -f uServerPool mirror /dev/sdd1 /dev/sde1; sudo zpool create -f uServerPool mirror /dev/vdb1 /dev/vdc1; sudo zpool add -f uServerPool mirror /dev/vdd1 /dev/vde1; ls -lah /dev/disk/by-id; total 0 drwxr-xr-x 2 root root 400 Jan 5 14:59 . drwxr-xr-x 8 root root 160 Jan 5 14:16 .. lrwxrwxrwx 1 root root 9 Jan 5 14:16 ata-hp_DVDRW_DU8A6SH_4A6605904686 -> ../../sr0 lrwxrwxrwx 1 root root 9 Jan 5 14:16 ata-ST8000VN004-2M2101_WSD21J73 -> ../../sdc lrwxrwxrwx 1 root root 9 Jan 5 14:16 ata-WDC_WD8004FRYZ-01VAEB0_VRGXVEKK -> ../../sdb lrwxrwxrwx 1 root root 10 Jan 5 14:16 ata-WDC_WD8004FRYZ-01VAEB0_VRGXVEKK-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 9 Jan 5 14:16 ata-WDC_WDBNCE5000PNC_181237420295 -> ../../sda lrwxrwxrwx 1 root root 10 Jan 5 14:16 ata-WDC_WDBNCE5000PNC_181237420295-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Jan 5 14:16 ata-WDC_WDBNCE5000PNC_181237420295-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Jan 5 14:16 ata-WDC_WDBNCE5000PNC_181237420295-part3 -> ../../sda3 lrwxrwxrwx 1 root root 10 Jan 5 14:16 ata-WDC_WDBNCE5000PNC_181237420295-part4 -> ../../sda4 lrwxrwxrwx 1 root root 9 Jan 5 14:59 usb-Generic-_SD_MMC_MS_PRO_20120926571200000-0:0 -> ../../sdd sudo zpool create -f -m /home/DataPool DataPool mirror \ ata-WDC_WD8004FRYZ-01VAEB0_VRGXVEKK \ ata-ST8000VN004-2M2101_WSD21J73; la by-id; total 0 drwxr-xr-x 2 root root 760 Jan 22 17:49 ./ drwxr-xr-x 8 root root 160 Jan 22 17:49 ../ lrwxrwxrwx 1 root root 9 Jan 22 17:49 ata-SPCC_Solid_State_Disk_AAAA0000000000020174 -> ../../sda lrwxrwxrwx 1 root root 10 Jan 22 17:49 ata-SPCC_Solid_State_Disk_AAAA0000000000020174-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Jan 22 17:49 ata-SPCC_Solid_State_Disk_AAAA0000000000020174-part2 -> ../../sda2 lrwxrwxrwx 1 root root 9 Jan 22 17:49 ata-ST6000NM0044_Z4D0YAGJ -> ../../sdc lrwxrwxrwx 1 root root 10 Jan 22 17:49 ata-ST6000NM0044_Z4D0YAGJ-part1 -> ../../sdc1 lrwxrwxrwx 1 root root 9 Jan 22 17:49 ata-ST6000NM0044_Z4D1Z3ZJ -> ../../sdb lrwxrwxrwx 1 root root 10 Jan 22 17:49 ata-ST6000NM0044_Z4D1Z3ZJ-part1 -> ../../sdb1 sudo zpool create -f DataPool mirror \ ata-ST6000NM0044_Z4D1Z3ZJ \ ata-ST6000NM0044_Z4D0YAGJ; :a.2 # - - # # - HDDs - # sudo zpool create uServerPool mirror /dev/sdb /dev/sdc; sudo zpool create uServerPool mirror /dev/sda /dev/sdb; /dev/sdb 10Tb /dev/sdc 10Tb Available HDD = 10Tb sudo zpool create -f DataPool mirror \ /dev/vdb /dev/vdc; :a.3 # - - # # - Disk failure - # # - Status DataPool - # zpool status -v; zpool status -v DataPool; zpool iostat; zpool iostat -v; zpool iostat -v DataPool; #sudo zpool import -f Data; zpool list; zpool status; zpool status -v; zpool status -v Data; sudo zpool clear Data; sudo zpool scrub Data; zpool iostat; capacity operations bandwidth pool alloc free read write read write ---------- ----- ----- ----- ----- ----- ----- DataPool 7.29G 92.2G 1 0 261K 1.18K zpool iostat -v; capacity operations bandwidth pool alloc free read write read write ---------- ----- ----- ----- ----- ----- ----- DataPool 7.29G 92.2G 1 0 255K 1.15K vdb 7.29G 92.2G 1 0 255K 1.15K ---------- ----- ----- ----- ----- ----- ----- zpool status DataPool; NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT DataPool 99.5G 1.27G 98.2G - - 0% 1% 1.00x DEGRADED - mirror 99.5G 1.27G 98.2G - - 0% 1.27% - DEGRADED vdb - - - - - - - - ONLINE 11861624942519774474 - - - - - - - - FAULTED # - - # # - Offline, remove & detach FAULTED disk - # sudo zpool offline DataPool 11861624942519774474; sudo zpool remove DataPool 11861624942519774474; sudo zpool detach DataPool 11861624942519774474; # - - # # - Create a new GPT partition table - # # - Attached it again with mirror - # sudo zpool attach DataPool /dev/vdb /dev/vdc; :b # - - # # - Create strips pools - # sudo zpool create uServerPool /dev/sdb /dev/sdc; /dev/sdb 10Tb /dev/sdc 10Tb Available Hdd = 20Tb :c # - - # # - Commands - # zpool status -v; zpool lists; df -kh; zfs list; :d # - - # # - Add disks to ZFS pool - # sudo add uServerPool mirror /dev/sdd /dev/sde; :e # - - # # - Create DataSets in ZFS pool - # sudo zfs create DataPool/Images; sudo zfs create DataPool/Images/Backup; sudo zfs create DataPool/Images/IS-DOS-Programs; sudo zfs create DataPool/Images/LearningEnglish; sudo zfs create DataPool/Images/Programs; sudo zfs create DataPool/Images/VManager; sudo zfs create DataPool/Documents; sudo zfs create DataPool/Documents/Videos; sudo zfs create DataPool/WebServer; sudo chown -R is_derayo:is_derayo /DataPool; chmod -R 775 /DataPool; mkdir -p /DataPool/Images/Programs/Linux.Img; mkdir -p /DataPool/Images/Programs/Macintosh.Img; mkdir -p /DataPool/Images/Programs/Microsoft.Img; mkdir -p /DataPool/Webserver/www; ln -s /DataPool/Images/Programs /DataPool/WebServer/www/Programs; :f # - - # # - Destroy ZFS pool (rm -r ...) - # #sudo zpool destroy uServerPool; :g # - - # # - Create ZFS RaidZ pool (rm -r ...) - # #sudo zpool create uServerPool raidz /dev/sdb /dev/sdc /dev/sdd; zpool status; :h # - - # # - Add disks to ZFS RaidZ pool (rm -r ...) - # sudo zpool add uServerPool raidz /dev/sde /dev/sdf /dev/sdg; zpool status; zpool list; zfs list; :i.1 # - - # # - Create DataSets in ZFS pool - # sudo zfs create uServerPool/Data; sudo zfs create uServerPool/Apps; sudo zfs create uServerPool/Data/Images; sudo chown -R is_derayo:is_derayo /uServerPool/Data/Images; chmod -R 775 /uServerPool/Data/Images; mkdir -p uServerPool/Data/Images/Programs; :i.2 # - - # # - Destroy DataSets in ZFS pool - # sudo zfs destroy Data/Images/Backup; sudo zfs destroy Data/Images/Programs; sudo zfs destroy Data/Images/VManager; cd /Data; sudo zfs destroy Data/Images; :j # - - # # - Mount Zfs DataPool - # zpool status -v; zpool lists; df -kh; zfs list; sudo apt install zfsutils-linux -y; la /dev/disk/by-label/ total 0 drwxr-xr-x 2 root root 120 Jan 24 19:59 ./ drwxr-xr-x 8 root root 160 Jan 24 19:41 ../ lrwxrwxrwx 1 root root 10 Jan 24 19:59 Data -> ../../vda2 lrwxrwxrwx 1 root root 10 Jan 24 19:41 DataPool -> ../../vdc1 lrwxrwxrwx 1 root root 9 Jan 24 19:41 'Ubuntu-Server\x2022.04\x20LTS\x20amd64' -> ../../sr0 lrwxrwxrwx 1 root root 10 Jan 24 19:59 uServer -> ../../vda1 sudo zpool status -v DataPool; sudo zpool import -f -l -d /dev/disk/by-label DataPool; sudo zpool status -v DataPool; #sudo zpool import -a; #sudo zpool import -D -f DataPool; :k # - - # # - Replace a HDD - # sudo zpool replace uServerPool /dev/sdc /dev/sdh; zpool status; sudo zpool replace uServerPool /dev/sdh /dev/sdc; zpool status; :l # - - # # - Semulate an error in a HDD - # sudo zpool offline uServerPool /dev/sdc; zpool status; sudo zpool online uServerPool /dev/sdc; zpool status; zfs list; :m # - - # # - Set Quota to a DataSet(folder) - # sudo zfs set quota=100m uServerPool/Data; sudo zfs set quota=50G uServerPool/Data; sudo zfs set quota=100M uServerPool/Data/Images; zfs list; zfs list uServerPool; zfs list uServerPool/Data; zfs get all uServerPool; zfs get all uServerPool/Data; sudo zfs set quota=500m uServerPool/Data; sudo zfs set reservation=5G uServerPool/Apps; df -kh; zfs list; zfs get all uServerPool; zfs get all uServerPool/Apps; zfs get all uServerPool/Data/Images; sudo zfs set reservation=100M uServerPool/Data/Images; zpool status; zpool list; zfs list; zfs list uServerPool; :n # - - # # - Scrub uServerPool - # sudo zpool scrub uServerPool; zpool status; :o # - - # # - Create log mirrors - # sudo zpool add uServerPool log mirror /dev/sdi /dev/sdj; zpool status; :p # - - # # - Create cache mirrors - # sudo zpool add uServerPool cache mirror /dev/sdk /dev/sdl; sudo zpool add uServerPool cache /dev/sdk /dev/sdl; zpool status; :q # - - # # - Create SnapShots - # sudo zfs snapshot uServerPool@2021-12-20; sudo zfs snapshot uServerPool/Data@2021-12-20; :r # - - # # - List SnapShots - # zfs list -t snapshot; df -kh; :s # - - # # - Rollback SnapShots - # sudo zfs rollback uServerPool/Data@2021-12-20; # - - # # - Manage Snapshots - # # - - # # - Data listsnapshots property - # zpool get listsnapshots Data; NAME PROPERTY VALUE SOURCE DataPool listsnapshots off default sudo zpool set listsnapshots=on Data; # - - # # - Create Data nested Snapshot - # sudo zfs snapshot -r Data@Data.Snapshot_$(date +%Y-%m-%d_%H-%M-%S); zfs list -rt snapshot Data; NAME USED AVAIL REFER MOUNTPOINT Data@Data.Snapshot_2022-02-13_11-57-08 0B - 24K - Data/Documents@Data.Snapshot_2022-02-13_11-57-08 0B - 26K - Data/Documents/Downloads@Data.Snapshot_2022-02-13_11-57-08 0B - 24K - Data/Documents/Music@Data.Snapshot_2022-02-13_11-57-08 0B - 24K - Data/Documents/Pictures@Data.Snapshot_2022-02-13_11-57-08 0B - 24K - Data/Documents/Videos@Data.Snapshot_2022-02-13_11-57-08 0B - 24K - # - - # # - Roolback Data Snapshot - # zfs list -rt snapshot Data; sudo zfs rollback @ sudo zfs rollback Data@Data.Snapshot_2022-02-13_11-57-08; # - - # # - Destroy snapshot (DANGEROUS!) - # zfs list -rt snapshot Data; sudo zfs destroy -r Data@Data.Snapshot_2022-02-10_00-02-31; # - - # # - DataPool listsnapshots property - # zpool get listsnapshots DataPool; NAME PROPERTY VALUE SOURCE DataPool listsnapshots off default sudo zpool set listsnapshots=on DataPool; # - - # # - Create DataPool nested Snapshot - # sudo zfs snapshot -r DataPool@DataPool.Snapshot_$(date +%Y-%m-%d_%H-%M-%S); zfs list -rt snapshot DataPool; # - - # # - Roolback DataPool Snapshot - # zfs list -rt snapshot DataPool; sudo zfs rollback @ sudo zfs rollback DataPool@DataPool.Snapshot_2022-02-13_11-57-08; # - - # # - Destroy snapshot (DANGEROUS!) - # zfs list -rt snapshot DataPool; sudo zfs destroy -r DataPool@DataPool.Snapshot_2022-02-10_00-02-31; :t # - - # # - Backup uServerPool to another machine - # :t.1 # - - # # - Unmount (export) uServerPool - # # - Nobody can by using, loging, cd, etc, the uServerPool - # cd / sudo zpool export uServerPool; zpool status; :t.2 # - - # # - Backup uServerPool - # :t.3 # - - # # - Mount (import) uServerPool - # sudo zpool import uServerPool; :Option 2 # - - # # - Create zfs pools by /dev/disk/by-id; - # :a # - - # # - Prepare new disks - # :a.1 # - - # # - Format new disks - # Start system with Zorin Lite 16 ISO User gparted :a.2 # - - # # - List new disks - # lsblk -f; sudo fdisk -l; Disk /dev/vdb: 100 GiB, 107374182400 bytes, 209715200 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 0EE32BF6-3AC4-4D5D-B2B7-CD494C9CFF37 Device Start End Sectors Size Type /dev/vdb1 2048 209713151 209711104 100G Linux filesystem Disk /dev/vdc: 100 GiB, 107374182400 bytes, 209715200 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: D2E78079-CDCF-4FE9-BF5B-B981B1A27238 Device Start End Sectors Size Type /dev/vdc1 2048 209713151 209711104 100G Linux filesystem :b # - - # # - Check bad sectors - # # - Very slow process - # #sudo badblocks -b 512 -sw /dev/vdb; #sudo badblocks -b 512 -sw /dev/vdc; #sudo badblocks -b 512 -sw /dev/vdd; #sudo badblocks -b 512 -sw /dev/vde; :c # - - # # - ID all disks - # :c.1 # - - # # - Phisical HDD - # cd /dev/disk/by-id; la; ll ata* -ltr; :c.2 # - - # # - VirtualManager HDD - # cd /dev/disk/by-uuid; la; ls -lah; cd /etc/zfs; sudo vim vdev_id.conf; alias 01 /dev/disk/by-uuid/f098df35-fb09-4b26-8466-458f483fb1ba # /dev/vdb1 alias 02 /dev/disk/by-uuid/80cc2824-f52a-4fdf-811f-0000891a7e50 # /dev/vdc1 alias 03 /dev/disk/by-uuid/91623602-5956-40ac-bb6f-97346e71cfc3 # /dev/vdd1 alias 04 /dev/disk/by-uuid/6cead64c-d0c5-4b20-ac92-fba28b69a9db # /dev/vde1 sudo udevadm trigger; cd /dev/disk/; la; cd by-vdev; la; :d # - - # # - Create ZFS pool - # :d.1 # - - # # - Create ZFS pool - # sudo zpool create -f uServerPool mirror 01-part1 02-part1 mirror 03-part1 04-part1; sudo zpool create -f poolname mirror 01-part1 02-part1 mirror 03-part1 04-part1; :d.1 # - - # # - Check ZFS pool - # zpool status; zpool list -v; :e # - - # # - Only on Phisical HDD - # # - Setup compression on ZFS pool - # #sudo zfs set compression=lz4 uServerPool; #zfs get compression uServerPool; #zfs get compressratio uServerPool; :f # - - # # - Only on Phisical HDD - # # - Create folders inside the ZFS pool - # #sudo zfs create uServerPool/Images; :g # - - # # - Change ownership/Properties on uServerPool/Folders - # sudo chown -R is_derayo:is_derayo /uServerPool/Images; chmod -R 775 /uServerPool/Images; # - eof - #