From 9a5788a5faf5699da9cb85d5294b8696b0e0e4f0 Mon Sep 17 00:00:00 2001 From: Markus Ressel Date: Tue, 29 Mar 2022 04:11:01 +0200 Subject: [PATCH] added section about logging to file --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b7b8113..6c7f2e2 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Dependencies: You can print a help message by running the script without any parameters: -``` +```shell ./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. The easiest way to achieve this is by **running the script as root**. -``` +```shell sudo su ./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: -``` +```shell 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 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.