跳过正文

Add new Hard Disk to Linux

Tech Linux Hard Disk
浮世絵空事
作者
浮世絵空事
所谓灵魂 几行代码

Add new Hard Disk to Linux Conver to GTP, format disk and mount disk

Step 1. Find new drive
#

sudo fdisk -lu

Check message and find new drive

For example, new drive is /dev/sdx

Step 2. Conver to GPT
#

sudo parted /dev/sdx
mklabel gpt

Learn more about GPT(GUID Partition Table) on wikipedia: Engilsh Chinese

Step 3. Format to ext4
#

sudo mkfs -t ext4 /dev/sdx

Step 4. Mount Hard Disk
#

sudo df -lh # check partition
sudo mkdir /path/to/mount/drive
sudo mount -t ext4 /dev/sdx /path/to/mount/drive
sudo df -lh # confirm setting

Step 5. Auto-Mount on start-up
#

ls -l /dev/disk/by-uuid/
sudo vim /etc/fstab
# add messages
UUID=xxxxx    /path/to/mount/drive    ext4    defaults    0     3