# Update Storage Node

Stop service && backup config.toml

```
sudo systemctl stop zgs && cp $HOME/0g-storage-node/run/config.toml $HOME/0g-storage-node/run/config.toml.backup
```

Update

```
cd $HOME/0g-storage-node
git stash
git fetch --all --tags
git checkout 27979c2 
git submodule update --init
cargo build --release
```

update config.toml

```
mv $HOME/0g-storage-node/run/config.toml.backup $HOME/0g-storage-node/run/config.toml
```

ZGS Service Restart

```
sudo systemctl restart zgs
```

Log Check

```
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
```

Block Sync Check

```
while true; do 
    response=$(curl -s -X POST http://localhost:5678 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}')
    logSyncHeight=$(echo $response | jq '.result.logSyncHeight')
    connectedPeers=$(echo $response | jq '.result.connectedPeers')
    echo -e "logSyncHeight: \033[32m$logSyncHeight\033[0m, connectedPeers: \033[34m$connectedPeers\033[0m"
    sleep 5; 
done
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://services.dongqn.com/0g-storage-node/update-storage-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
