Difference between revisions of "Zfs resize disk"
Jump to navigation
Jump to search
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | https://discuss.linuxcontainers.org/t/how-to-resize-zfs-used-in-lxd/1333/9 | ||
+ | |||
Expand disk in Vsphere or qemu-img then | Expand disk in Vsphere or qemu-img then | ||
+ | ``` | ||
+ | echo 1 | sudo tee /sys/class/block/sdb/device/rescan | ||
+ | sudo partprobe -s | ||
+ | sudo partprobe -s | ||
+ | sudo systemctl restart zed | ||
+ | sudo journalctl -f | ||
+ | zpool list | ||
+ | # it seems it does auto online resize these days | ||
+ | ``` | ||
+ | |||
+ | Older | ||
``` | ``` | ||
echo 1 | sudo tee /sys/class/block/sdb/device/rescan | echo 1 | sudo tee /sys/class/block/sdb/device/rescan | ||
Line 7: | Line 21: | ||
``` | ``` | ||
sudo partprobe -s | sudo partprobe -s | ||
− | |||
lsblk | lsblk | ||
zpool list | zpool list | ||
Line 18: | Line 31: | ||
``` | ``` | ||
https://serverfault.com/questions/946055/increase-the-zfs-partition-to-use-the-entire-disk | https://serverfault.com/questions/946055/increase-the-zfs-partition-to-use-the-entire-disk | ||
+ | |||
+ | |||
+ | If you want autoexpand enabled | ||
+ | ``` | ||
+ | zpool get autoexpand zfspv-pool | ||
+ | zpool set autoexpand=on zfspv-pool | ||
+ | ``` | ||
+ | |||
+ | # Azure | ||
+ | - https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks | ||
+ | |||
+ | |||
+ | # Other options that will probably work but test first | ||
+ | |||
+ | ``` | ||
+ | parted /dev/sdb rm 9 | ||
+ | parted /dev/sdb resizepart 1 100% | ||
+ | ``` | ||
+ | |||
+ | |||
+ | # Trash notes | ||
+ | ``` | ||
+ | echo 1 | sudo tee /sys/class/block/sdb/device/rescan | ||
+ | zpool get autoexpand zfspv-pool | ||
+ | zpool set autoexpand=on zfspv-pool | ||
+ | |||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | sudo partprobe -s | ||
+ | sudo parted /dev/sdb rm 9 | ||
+ | sudo parted /dev/sdb resizepart 1 100% | ||
+ | zpool status -v | ||
+ | sudo zpool online -e zfspv-pool sdb | ||
+ | |||
+ | ``` | ||
+ | - https://serverfault.com/questions/946055/increase-the-zfs-partition-to-use-the-entire-disk | ||
+ | - https://serverfault.com/questions/703471/why-isnt-my-zfs-pool-expanding-using-zfs-on-linux | ||
+ | |||
+ | # Vmware discover new disk | ||
+ | ``` | ||
+ | echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan | ||
+ | ``` | ||
+ | |||
+ | |||
+ | # LXD default default.img resize | ||
+ | ``` | ||
+ | df -h # make sure you have space on your /var/snap/lxd/common/lxd/disks/ filesystem | ||
+ | sudo zpool status | ||
+ | sudo zpool list | ||
+ | sudo ls -lhat /var/snap/lxd/common/lxd/disks/default.img | ||
+ | sudo truncate -s +10G /var/snap/lxd/common/lxd/disks/default.img | ||
+ | sudo ls -lhat /var/snap/lxd/common/lxd/disks/default.img | ||
+ | sudo zpool online -e default /var/snap/lxd/common/lxd/disks/default.img | ||
+ | sudo zpool list | ||
+ | ``` |
Latest revision as of 05:09, 18 July 2024
https://discuss.linuxcontainers.org/t/how-to-resize-zfs-used-in-lxd/1333/9
Expand disk in Vsphere or qemu-img then
echo 1 | sudo tee /sys/class/block/sdb/device/rescan sudo partprobe -s sudo partprobe -s sudo systemctl restart zed sudo journalctl -f zpool list # it seems it does auto online resize these days
Older
echo 1 | sudo tee /sys/class/block/sdb/device/rescan
sudo partprobe -s lsblk zpool list sudo zpool online -e <POOL NAME> <DEVICE NAME> # zpool online -e mypoolname sdb zpool list # Note: # partprobe - command to inform the OS of partition table changes
https://serverfault.com/questions/946055/increase-the-zfs-partition-to-use-the-entire-disk
If you want autoexpand enabled
zpool get autoexpand zfspv-pool zpool set autoexpand=on zfspv-pool
Azure
Other options that will probably work but test first
parted /dev/sdb rm 9 parted /dev/sdb resizepart 1 100%
Trash notes
echo 1 | sudo tee /sys/class/block/sdb/device/rescan zpool get autoexpand zfspv-pool zpool set autoexpand=on zfspv-pool
sudo partprobe -s sudo parted /dev/sdb rm 9 sudo parted /dev/sdb resizepart 1 100% zpool status -v sudo zpool online -e zfspv-pool sdb
- https://serverfault.com/questions/946055/increase-the-zfs-partition-to-use-the-entire-disk
- https://serverfault.com/questions/703471/why-isnt-my-zfs-pool-expanding-using-zfs-on-linux
Vmware discover new disk
echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan
LXD default default.img resize
df -h # make sure you have space on your /var/snap/lxd/common/lxd/disks/ filesystem sudo zpool status sudo zpool list sudo ls -lhat /var/snap/lxd/common/lxd/disks/default.img sudo truncate -s +10G /var/snap/lxd/common/lxd/disks/default.img sudo ls -lhat /var/snap/lxd/common/lxd/disks/default.img sudo zpool online -e default /var/snap/lxd/common/lxd/disks/default.img sudo zpool list