---
title: "Clean up disks"
sidebar_label: "Clean up disks"
sidebar_position: 10
description: "How to clean up dedicated server disks"
---

import Formbricks from '@theme/MDXComponents/Formbricks'

# Clean up disks

If data from previous OS installations remains on the disks, perform a full manual disk cleanup.

1. [Boot the server in Rescue mode](#boot-to-rescue).
2. [Clean up the disks](#disks-cleanup).
3. [Change the boot template](#boot-to-default).

## 1. Boot the server in Rescue mode \{#boot-to-rescue}

1. In the [control panel](https://my.selectel.ru/servers), on the top menu, click **Products** and select **Dedicated Servers**.
2. In the **Servers** section, open the server page → **Operating System** tab.
3. Click **Change boot template**.
4. In the **Boot template** field, select **Boot to Rescue**.
5. Click **Save and reboot**. The server will be rebooted.

## 2. Clean up disks \{#disks-cleanup}

1. [Connect to the server via SSH](/dedicated/manage/connect-to-server.mdx#connect-via-ssh) or using the [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console).

2. Output the information about the disks:

   ```bash
   lsblk
   ```

   The disk information will appear in the response. Remember or copy the disk names. For example:

   ```bash
   NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
   sda           8:0    0   1.8T  0 disk
   └─sda1        8:1    0   1.8T  0 part /mnt/data
   sdb           8:16   0 931.5G  0 disk
   └─sdb1        8:17   0 931.5G  0 part /mnt/backup
   nvme0n1     259:0    0 465.8G  0 disk
   ├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
   ├─nvme0n1p2 259:2    0    16G  0 part [SWAP]
   └─nvme0n1p3 259:3    0 449.3G  0 part /
   ```

   Here `sda`, `sdb`, `nvme0n1` are the disk names.

3. Clear the partitions on each disk:

   ```bash
   fdisk /dev/<disk_name>
   ```

   Specify `<disk_name>` — the disk name you copied in step 2.

   If there are multiple partitions on the disk, enter `d` until all partitions are deleted.

4. Save the changes:

   ```bash
   w
   ```

5. Clear the file system signatures on each disk:

   ```bash
   wipefs -fa /dev/<disk_name>
   ```

   Specify `<disk_name>` — the disk name you copied in step 2.

6. Optional: perform a deep wipe of each disk:

   ```bash
   dd bs=512 if=/dev/zero of=/dev/<disk_name> count=2048 seek=$(('blockdev --getsz /dev/<disk_id>' - 2048))
   ```

   Specify `<disk_name>` — the disk name you copied in step 2.

## 3. Change the boot template \{#boot-to-default}

[Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or reboot the server from the OS. When you reboot the server from the OS, the boot template will automatically change to the one that was set before [booting the server in Rescue mode](#boot-to-rescue).

<Formbricks />
