[Storage] 替新硬碟建分區並掛載

回覆文章
Lexaul
文章: 231
註冊時間: 2019-10-18, 14:28

[Storage] 替新硬碟建分區並掛載

文章 Lexaul » 2023-08-18, 10:46

https://phoenixnap.com/kb/linux-create-partition

Create The Partition
Option 1: Partition a Disk Using parted Command
Step 1: List Partitions

代碼: 選擇全部

sudo parted -l
Step 2: Open Storage Disk

代碼: 選擇全部

sudo parted /dev/sdb

代碼: 選擇全部

select /dev/sdb
Step 3: Make a Partition Table

代碼: 選擇全部

mklabel gpt
Step 4: Check Table

代碼: 選擇全部

print
Step 5: Create Partition

代碼: 選擇全部

mkpart primary ext4 1MB 1855MB
Option 2: Partition a Disk Using fdisk Command
Step 1: List Existing Partitions

代碼: 選擇全部

sudo fdisk -l
Step 2: Select Storage Disk

代碼: 選擇全部

sudo fdisk /dev/sdb
Step 3: Create a New Partition
1. Run the n command to create a new partition.
2. Select the partition number by typing the default number.
3. After that, you are asked for the starting and ending sector of your hard drive. It is best to type the default number in this section.
4. The last prompt is related to the size of the partition. You can choose to have several sectors or to set the size in megabytes or gigabytes.

代碼: 選擇全部

Command (m for help): n
圖檔
Step 4: Write on Disk

代碼: 選擇全部

Command (m for help): w
Step 5: Verify that the partition is created

代碼: 選擇全部

sudo fdisk -l
Format the Partition

代碼: 選擇全部

sudo mkfs -t ext4 /dev/sdb1
Mount the Partition

代碼: 選擇全部

sudo mkdir -p /mt/sdb1
sudo mount -t auto /dev/sbd1 /mt/sdb1
df -hT
[email protected]
github.com/Lexaul

回覆文章