Sobes.tech
Junior — Middle

How is the configuration and preparation of disk devices carried out in the Linux operating system?

sobes.tech AI

Answer from AI

In Linux, disk device configuration and preparation typically involve the following steps:

  1. Device identification — using commands like lsblk, fdisk -l, blkid to see available disks and partitions.

  2. Creating partitions — utilities like fdisk, parted, or gdisk allow creating, deleting, and modifying disk partitions.

  3. Formatting partitions — creating a filesystem using commands like mkfs.ext4, mkfs.xfs, etc.

  4. Mounting partitions — attaching the filesystem to a mount point using mount.

  5. Configuring automatic mounting — adding an entry to the /etc/fstab file.

Example of creating a partition and formatting:

sudo fdisk /dev/sdb
# create a new partition inside fdisk
sudo mkfs.ext4 /dev/sdb1
sudo mkdir /mnt/data
sudo mount /dev/sdb1 /mnt/data

Thus, disk preparation includes partitioning, creating a filesystem, and mounting for system use.