Skip to main content

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.
  2. Clean up the disks.
  3. Change the boot template.

1. Boot the server in Rescue mode

  1. In the control panel, 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

  1. Connect to the server via SSH or using the KVM console.

  2. Output the information about the disks:

    lsblk

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

    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:

    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:

    w
  5. Clear the file system signatures on each disk:

    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:

    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

Restore the previous server boot template or reboot the server from the OS. When rebooting the server from the OS, the boot template will automatically revert to the one that was set before booting the server in Rescue mode.