added section about logging to file

This commit is contained in:
Markus Ressel 2022-03-29 04:11:01 +02:00
parent d62e6e0be7
commit 9a5788a5fa

View File

@ -86,7 +86,7 @@ Dependencies:
You can print a help message by running the script without any parameters: You can print a help message by running the script without any parameters:
``` ```shell
./zfs-inplace-rebalancing.sh ./zfs-inplace-rebalancing.sh
``` ```
@ -102,17 +102,29 @@ You can print a help message by running the script without any parameters:
Make sure to run this script with a user that has rw permission to all of the files in the target directory. Make sure to run this script with a user that has rw permission to all of the files in the target directory.
The easiest way to achieve this is by **running the script as root**. The easiest way to achieve this is by **running the script as root**.
``` ```shell
sudo su sudo su
./zfs-inplace-rebalancing.sh --checksum true --passes 1 /pool/path/to/rebalance ./zfs-inplace-rebalancing.sh --checksum true --passes 1 /pool/path/to/rebalance
``` ```
To keep track of the balancing progress, you can open another terminal and run: To keep track of the balancing progress, you can open another terminal and run:
``` ```shell
watch zpool list -v watch zpool list -v
``` ```
### Log to File
To write the output to a file, simply redirect stdout and stderr to a file (or separate files).
Since this redirects all output, you will have to follow the contents of the log files to get realtime info:
```shell
# one shell window:
tail -F ./stdout.log
# another shell window:
./zfs-inplace-rebalancing.sh /pool/path/to/rebalance >> ./stdout.log 2>> ./stderr.log
```
### Things to consider ### Things to consider
Although this script **does** have a progress output (files as well as percentage) it might be a good idea to try a small subfolder first, or process your pool folder layout in manually selected badges. This can also limit the damage done, if anything bad happens. Although this script **does** have a progress output (files as well as percentage) it might be a good idea to try a small subfolder first, or process your pool folder layout in manually selected badges. This can also limit the damage done, if anything bad happens.