# Enable AutoPruning in Pharos Node

This guide describes how to enable automatic data pruning on your Pharos node to manage disk space.

***

## For v0.11+ Deployment (New Structure)

If you deployed your node using the v0.11 deployment guide (Binary or Docker with the new structure), follow these steps.

### Step 1: Verify Node Status

Check if the node is running:

```bash
curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
  http://localhost:18100
```

### Step 2: Enable Pruning

**For Binary Deployment:**

```bash
cd /data/$WORKSPACE/bin
LD_PRELOAD=./libevmone.so ./pharos_cli prune --c ../pharos.conf --enable_auto_prune
```

**For Docker Deployment:**

```bash
docker exec -it pharos-node /bin/bash
cd /data/bin
LD_PRELOAD=./libevmone.so ./pharos_cli prune --c ../pharos.conf --enable_auto_prune
```

### Step 3: Query Pruning Settings (Optional)

**For Binary Deployment:**

```bash
cd /data/$WORKSPACE/bin
LD_PRELOAD=./libevmone.so ./pharos_cli prune --c ../pharos.conf --get
```

**For Docker Deployment:**

```bash
docker exec -it pharos-node /bin/bash
cd /data/bin
LD_PRELOAD=./libevmone.so ./pharos_cli prune --c ../pharos.conf --get
```

Expected output:

```
PruneInfo:
enable_auto_prune: 1
auto_prune_reserved_window: 100000
prune_reserved_version: xxxxxx
flushed_version: xxxxxx
real_prune_reserved_version: xxxxxxx
```

If `enable_auto_prune` is `1`, auto pruning is enabled.

***

## For Legacy Deployment (Pre-v0.11)

If you deployed your node using the old Python ops tool, follow these steps.

### Step 1: Verify Node Status

```bash
curl 127.0.0.1:18100/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

### Step 2: Enable Pruning

Enter the container and enable auto-pruning:

```bash
docker exec -it pharos-testnet /bin/bash
cd /data/pharos-node/domain/client/bin/
LD_PRELOAD=./libevmone.so ./pharos_cli prune --enable_auto_prune
```

### Step 3: Query Pruning Settings (Optional)

```bash
docker exec -it pharos-testnet /bin/bash
cd /data/pharos-node/domain/client/bin/
LD_PRELOAD=./libevmone.so ./pharos_cli prune --get
```

Expected output:

```
PruneInfo:
enable_auto_prune: 1
auto_prune_reserved_window: 100000
prune_reserved_version: xxxxxx
flushed_version: xxxxxx
real_prune_reserved_version: xxxxxxx
```

If `enable_auto_prune` is `1`, auto pruning is enabled.


---

# 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://docs.pharos.xyz/enable-pruning-in-pharos-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.
