Connecting and Disconnecting a Disk in Linux¶
Note
For VPS servers use the upgrade plan option. Below is the instruction only for dedicated Linux servers.
Connecting a Disk¶
After attaching the disk, you need to prepare it within the OS. The process consists of four stages:
- Create a partition;
- Format (create a filesystem);
- Mount;
- Add to
/etc/fstabfor autostart.
Before preparing the disk, you need to identify the disk names present in the system.
You can list disks with the following command:
Example output:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 15G 0 disk
└─sda1 8:1 0 15G 0 part /
sdb1 8:16 0 10G 0 disk # new disk (no partitions)
vda 252:0 0 1M 1 disk
In this example, the new disk is /dev/sdb1. All commands below use it as an example. Replace sdb with the actual name in your system.
1. Creating a Partition (fdisk)¶
Start the interactive mode for the disk:
Sequence of actions:
- Press
n→ create a new partition; - Choose
p→ primary; - Press
Enterthree times (keep default values: whole disk, first sector, etc.); - Press
w→ write changes and exit.
Check the result:
A new partition should now appear, e.g., /dev/sdb1.

2. Creating a Filesystem¶
For example, use ext4 — a reliable and widely supported filesystem:
Note
Alternatives: xfs, btrfs, ntfs (via mkfs.ntfs) — depending on your needs.
3. Mounting the Disk¶
Create a mount point (directory):
Mount the partition:
Verify:

The disk is now ready for use: all files in /mnt/disk2 will be stored on the new disk.
4. Automatic Mounting at Boot (/etc/fstab)¶
Using the UUID (instead of /dev/sdb1) ensures stability when disk order changes.
Retrieve the partition's UUID:
Example output:
NAME UUID
sda
└─sda1 073e596c-0101-4b87-8f4e-40f96b90baa9
sdb
└─sdb1 1a138d62-46e2-4c2c-9d41-f488d6e340a4
Open /etc/fstab:
Add the following line (replace the UUID and path as needed):
Note
defaults — standard mount options (rw, suid, dev, exec, auto, nouser, async); 0 — not included in dumps; 2 — filesystem check at boot (after root).
Disconnecting the Disk¶
A local disk cannot be removed if the server has a recovery point. First delete it in the control panel.
Steps:¶
-
Edit
/etc/fstaband comment out or remove the line with the disk: -
Unmount the disk:
Note
The
-l(lazy) flag is useful if the disk is busy (e.g., a session is open inside the mount point). -
Remove the mount point (optional):