Creating Disk Partitions and Mounting in Linux

2022年7月28日 3072点热度 1人点赞 2条评论
内容目录

Execute fdisk -l to find the required disk.

file
file

As you can see, this is a blank disk.
Start executing commands to create a partition on the blank disk.

fdisk  /dev/sdc

First, enter n.

file

Command action <- Select the type of partition to create
e extended <- Extended partition
p primary partition (1-4) <- Primary partition

Enter p, then enter 1, and press Enter for the remaining options.

file

Enter w, to save and exit.

file

Format and set the disk filesystem:

mkfs.ext4 /dev/sdc1

Mount

mount /dev/sdc1 /data/

Check the disk mount status:

df -lh

file

Set up automatic mounting at boot.

vim /etc/fstab

Add:

/dev/sdc               /data              ext4    defaults        0 2

file

痴者工良

高级程序员劝退师

文章评论