Skip to main content
alaxkar
Staff
Staff
Feb 7, 2025 9:47 AM UTC

Technical Tip: How to remove a mounted disk from a ClickHouse server

Description

This article describes how to delete a mounted disk in ClickHouse if it is no longer usable.

Scope

FortiSIEM.

Solution

To delete a mounted disk in ClickHouse if it is no longer usable, follow these steps:

 

Mounted disk


Step 1: Create a backup of the fstab file and remove the corresponding entry from /etc/fstab:

In order, these commands:

  • Verify the mount point.

  • Create a backup for the fatab file.

  • Remove the data-clickhouse line from file.

  • Verify the ClickHouse-related contents of the fstab directory directory.


cat /etc/fstab | grep data-clickhouse  
sed -i.bak '/data-clickhouse\./d' /etc/fstab
sed -i.bak '/data-clickhouse/d' /etc/fstab
cat /etc/fstab | grep /data-clickhouse 

 

etc.png

 

Step 2: Unmount the disk from the server. The mount point can be obtained using the df -h command.

umount /data-clickhouse-hot-1


Step 3: Remove the ClickHouse directory after un-mounting from the filesystem. 

rm -rf /data-clickhouse-hot-1


This could be warm or hot, depending on whether it needs to be replaced.

Step 4: Log in to FortiSIEM and remove the node from the GUI by navigating to Admin -> License -> Nodes and remove the Hot Tier as shown in the screenshot below.

admin.jpg


If there is more than one HOT, WARM or COLD in use: under Analytics -> Advanced Search, use the example below.

SELECT
    name,
    active,
    disk_name,
    path
FROM system.parts
WHERE path ILIKE '%hot-2%'


Note: This operation may lead to some warnings in the /opt/clickhouse/log/clickhouse-server.err.log log file:

<Warning> fsiem.events_replicated (ReplicatedMergeTreePartCheckThread): Found parts with the same min block and with the same max block as the missing part 18250-20250205_371_375_1 on replica 1. Hoping that it will eventually appear as a result of a merge.
<Error> fsiem.events_replicated (ReplicatedMergeTreePartCheckThread): No replica has part covering 18250-20250205_353_378_2 and a merge is impossible: we didn't find a smaller part with the same max block.
<Warning> fsiem.events_replicated (a5a85f1a-6ebf-4cf1-b82b-686f928798cc): Cannot commit empty part 18250-20250205_353_378_2 with error DB::Exception: Part 18250-20220620_353_378_2 (state Outdated) already exists, but it will be deleted soon

 

These warnings do not affect the system. But if they are too frequent, run the following commands to suppress them:

clickhouse-client --query "SELECT replica_path || '/queue/' || node_name FROM system.replication_queue JOIN system.replicas USING (database, table) WHERE last_exception LIKE '%No active replica has part%'" | while read i; do /opt/zookeeper/bin/zkCli.sh deleteall $i; done

clickhouse-client --query "SYSTEM RESTART REPLICAS"

    Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
    Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT