To check the disk of a Linux instance on a cloud server, you can use the following commands:
List all disks:
Use lsblk or fdisk -l to view available disks and partitions.
Example:
lsblk
or
sudo fdisk -l
Check disk usage:
Use df -h to see mounted filesystems and their usage.
Example:
df -h
Check disk health (if SMART is supported):
Use smartctl (install via sudo apt install smartmontools or sudo yum install smartmontools).
Example:
sudo smartctl -a /dev/sda
To format a partition:
Unmount the partition (if mounted):
Example:
sudo umount /dev/sdX1
Format the partition (e.g., with ext4):
Example:
sudo mkfs.ext4 /dev/sdX1
Mount the formatted partition:
Example:
sudo mount /dev/sdX1 /mnt/mydisk
If you're using Tencent Cloud, you can manage disks via the Tencent Cloud Console under Cloud Block Storage (CBS). For automated disk operations, Tencent Cloud provides Cloud-Init and Tencent Cloud API for scripting. Additionally, Tencent Cloud Monitor can help track disk performance.