# - bof - # # - - # # - 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 uServerLiveDVD / Open terminal - # Alt+F2 # :2 # - - # # - sudo as root - # sudo -i; # :3 # - - # # - 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 # - - # # - Restart ssh service - # systemctl restart ssh; # :5 # - - # # - Change root password - # passwd; ip -c a; # :6 # - - # # - Add universe repository, update, upgrade - # ssh uServerLiveDVD ssh root@10.0.0.44; apt update; # :6.1 # - - # # - Download script - # sudo bash; wget http://10.0.0.100/Images/Programs/Linux.Img/Linux_Ubuntu.Img/Ubuntu_Server.Img/1-Linux_Configuration_Files/General-Documentation_uServer/uServer_Setup-Configuration_Updated/uServer_ZFS_Install/Videos/uServer_ZFS-Procedure/ssh-add.sh; wget http://10.0.0.100/Images/Programs/Linux.Img/Linux_Ubuntu.Img/Ubuntu_Server.Img/1-Linux_Configuration_Files/General-Documentation_uServer/uServer_Setup-Configuration_Updated/uServer_ZFS_Install/Videos/uServer_ZFS-Procedure/zfs-installer.sh; chmod +x ssh-add.sh zfs-installer.sh; sudo ./ssh-add.sh; # - - # # - ssh from another terminal with user someuser - # ssh myuser@10.0.0.45 passwd: a sudo bash; cd /root; sudo ./zfs-installer.sh; # :7 # - - # # - Install initial software - # apt install --yes debootstrap gdisk zfs-initramfs; # :8 # - - # # - Prepare disk - # lsblk; sgdisk --zap-all /dev/vda; lsblk; # - - # # - Create EFI, BOOT & ROOT partitions - # sgdisk -n2:1M:+512M -t2:EF00 /dev/vda; sgdisk -n3:0:+640M -t3:BF01 /dev/vda; sgdisk -n4:0:0 -t4:BF01 /dev/vda; lsblk; # - - # # - Show partitions - # parted /dev/vda; p q=quit # - - # # - 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 # :8 # - - # # - Create BOOT POOL (bpool) Zfs partition - # zpool create -o ashift=12 -d \ -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 # :9 # - - # # - Create ROOT POOL (rpool) Zfs partition - # zpool create -o ashift=12 \ -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 #sudo zpool import -f Data; zpool list; zpool status; zpool status -v; zpool status -v Data; sudo zpool clear Data; sudo zpool scrub Data; # :10 # - - # # - 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) - # debootstrap lunar /mnt; # :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 - # rm -r /mnt/etc/netplan/00-installer-config.yaml; echo 'network:' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' ethernets:' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' enp1s0:' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' dhcp4: no' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' addresses: [192.168.122.130/24]' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' gateway4: 192.168.122.1' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' nameservers:' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' addresses: [8.8.8.8, 8.8.4.4]' >> /mnt/etc/netplan/00-installer-config.yaml; echo ' version: 2' >> /mnt/etc/netplan/00-installer-config.yaml; # vim /mnt/etc/netplan/00-installer-config.yaml; # 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 - # rm -r /mnt/etc/apt/sources.list; echo 'deb http://archive.ubuntu.com/ubuntu lunar main universe' >> /mnt/etc/apt/sources.list; echo 'deb-src http://archive.ubuntu.com/ubuntu lunar main universe' >> /mnt/etc/apt/sources.list; echo '' >> /mnt/etc/apt/sources.list; echo 'deb http://security.ubuntu.com/ubuntu lunar-security main universe' >> /mnt/etc/apt/sources.list; echo 'deb-src http://security.ubuntu.com/ubuntu lunar-security main universe' >> /mnt/etc/apt/sources.list; echo '' >> /mnt/etc/apt/sources.list; echo 'deb http://archive.ubuntu.com/ubuntu lunar-updates main universe' >> /mnt/etc/apt/sources.list; echo 'deb-src http://archive.ubuntu.com/ubuntu lunar-updates main universe' >> /mnt/etc/apt/sources.list; # 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 /etc/mtab; ln -s /proc/self/mounts /etc/mtab; # :17 # - - # # - Configuring locales, timezone - # apt update; 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; apt install --yes nano vim; # :18 # - - # # - Install ubuntu linux kernel, zfs-initramfs & dosfstools - # apt install --yes --no-install-recommends linux-image-generic; apt install --yes zfs-initramfs; apt install 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=76E9-1713 /boot/efi vfat nofail,x-systemd.device-timeout=1 0 1" >> /etc/fstab; mount /boot/efi; lsblk; # :20 # - - # # - Install grub, set root passwd - # apt install --yes grub-efi-amd64-signed shim-signed; passwd; # :21 # - - # # - Configuring services - # rm -r /etc/systemd/system/zfs-import-bpool.service; echo '[Unit]' >> /etc/systemd/system/zfs-import-bpool.service; echo 'DefaultDependencies=no' >> /etc/systemd/system/zfs-import-bpool.service; echo 'Before=zfs-import-scan.service' >> /etc/systemd/system/zfs-import-bpool.service; echo 'Before=zfs-import-cache.service' >> /etc/systemd/system/zfs-import-bpool.service; echo '' >> /etc/systemd/system/zfs-import-bpool.service; echo '[Service]' >> /etc/systemd/system/zfs-import-bpool.service; echo 'Type=oneshot' >> /etc/systemd/system/zfs-import-bpool.service; echo 'RemainAfterExit=yes' >> /etc/systemd/system/zfs-import-bpool.service; echo 'ExecStart=/sbin/zpool import -N -o cachefile=none bpool' >> /etc/systemd/system/zfs-import-bpool.service; echo '' >> /etc/systemd/system/zfs-import-bpool.service; echo '[Install]' >> /etc/systemd/system/zfs-import-bpool.service; echo 'WantedBy=zfs-import.target' >> /etc/systemd/system/zfs-import-bpool.service; # 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; # - - # # - 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; 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; 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 - #