Created
December 4, 2019 18:25
-
-
Save liejuntao001/c736301623683e52a64fbcd2a1e9470f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# References | |
https://docs.oracle.com/cd/E19253-01/819-5461/gayog/index.html | |
https://gist.github.com/satmandu/4da5e900c2c80c93da38c76537291507 | |
# Commands to add a zfs volume | |
sudo zfs create -o mountpoint=/home/me/workspace rpool/USERDATA/me_workspace1_c7bzj1 | |
sudo zfs create -o mountpoint=/home/me/VirtualBoxVMs rpool/USERDATA/me_virtualbox_c7bzj1 | |
# create partitions for a new disk to be used by zfs | |
Disk /dev/sdb: 894.26 GiB, 960197124096 bytes, 1875385008 sectors | |
Disk model: Crucial_CT960M50 | |
Units: sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 4096 bytes | |
I/O size (minimum/optimal): 4096 bytes / 4096 bytes | |
Disklabel type: gpt | |
Disk identifier: F65C716F-49FE-0847-868C-412289E32D81 | |
Device Start End Sectors Size Type | |
/dev/sdb1 2048 1050623 1048576 512M EFI System | |
/dev/sdb2 1050624 1153023 102400 50M Linux filesystem | |
/dev/sdb3 1153024 80844799 79691776 38G Linux swap | |
/dev/sdb4 80844800 85039103 4194304 2G Solaris boot | |
/dev/sdb5 85039104 1875384974 1790345871 853.7G Solaris root | |
# list by-id | |
$ ls -al /dev/disk/by-id | |
lrwxrwxrwx 1 root root 9 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497 -> ../../sdb | |
lrwxrwxrwx 1 root root 10 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497-part1 -> ../../sdb1 | |
lrwxrwxrwx 1 root root 10 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497-part2 -> ../../sdb2 | |
lrwxrwxrwx 1 root root 10 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497-part3 -> ../../sdb3 | |
lrwxrwxrwx 1 root root 10 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497-part4 -> ../../sdb4 | |
lrwxrwxrwx 1 root root 10 Dec 1 22:40 ata-Crucial_CT960M500SSD1_13250940E497-part5 -> ../../sdb5 | |
# create zpool by-id | |
sudo zpool create spool ata-Crucial_CT960M500SSD1_13250940E497-part5 | |
# create the file system with properties similar to rpool | |
sudo zfs create -o utf8only=on -o normalization=formD -o mountpoint=none spool/STORAGE | |
sudo zfs set compression=lz4 spool | |
sudo zfs set xattr=sa spool | |
sudo zfs set dnodesize=auto spool | |
sudo zfs set acltype=posixacl spool | |
sudo zfs set relatime=on spool | |
sudo zfs create -o mountpoint=/opt/storage spool/STORAGE/ubuntu_rjrf4u | |
sudo zfs create -o mountpoint=/opt/storage/me spool/STORAGE/me_storage_c7bzj1 | |
# destroy zpool | |
sudo zpool destroy spool | |
# take a snapshot | |
zfs snapshot rpool/USERDATA/me_workspace1_c7bzj1@$(date +%F_%H:%M:%S) | |
# list snapshots | |
zfs list -t snapshot | |
# spool doesn't auto mount at boot. follow the solution in | |
bug: https://bugs.launchpad.net/ubuntu/+source/zsys/+bug/1849522 | |
https://gist.github.com/satmandu/4da5e900c2c80c93da38c76537291507 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment