linux 4t磁盘格式化,Ubuntu 16.04系统挂载4T硬盘
終端輸入 sudo fdisk -l? 查看機器上都插了哪些安裝盤,看到/dev/sda,并且沒有進行分區且大小為3.7T,是要掛載的硬盤。
$ sudo fdisk -l
Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb091dbe9
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 498116607 498114560 237.5G 83 Linux
/dev/nvme0n1p2 498118654 500117503 1998850 976M 5 Extended
/dev/nvme0n1p5 498118656 500117503 1998848 976M 82 Linux swap / Solaris
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x2ef87b1f
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 1126399 1124352 549M 7 HPFS/NTFS/exFAT
/dev/sdb2 1128446 3907028991 3905900546 1.8T 5 Extended
/dev/sdb5 1128448 3874134015 3873005568 1.8T 83 Linux
/dev/sdb6 3874136064 3907028991 32892928 15.7G 82 Linux swap / Solaris
Partition 2 does not start on physical sector boundary.
然后運行如下命令:
sudo parted /dev/sda #進入parted
mklabel gpt #將磁盤設置為gpt格式,
mkpart logical 0 -1 #將磁盤所有的容量設置為GPT格式
print #查看分區結果
這個時候應該是默認進行分了一個/dev/sda1這個分區
然后退出parted,在終端輸入sudo mkfs.ext4 -F /dev/sda1
將剛剛分出來的sda1格式化為ext4的格式,然后就可以設置開機自動掛載了。
2、設置開機自動掛載
查看硬盤/dev/sda1 對應的UUID
sudo blkid
注意: 唯一的sda1的UUID號。
再事先準備好一個地方來做掛載點,比如我這里是/DATA4T然后再用命令打開配置文件:
終端輸入??sudo vim /etc/fstab
然后在文件末尾添加
UUID=7941f2c5-d582-4414-85c5-6d199a701795 /DATA4T? ? ? ?ext4? ? defaults 0? ? ? ?0
最后重啟電腦。
由于/DATA4T?是在根目錄下,為便于操作,需將其用戶屬性從 root改成 普通用戶。
附錄:
常用相關命令:
lsblk -f?可以查看硬盤UUID
fdisk -l?查看硬盤
mkfs.ext4 /dev/vdb?格式化硬盤
blkid?查看磁盤的UUID
參考:
sudofdisk /dev/sdb分區 操作詳解
一、硬盤分區 | Hard disk add new partition
1、顯示硬盤及所屬分區情況。在終端窗口中輸入如下命令:
sudo fdisk -l
顯示當前的硬盤及所屬分區的情況。如下圖所示:
系統提示:DIsk /dev/sdb doesn't contain a valid partition table。
2、對硬盤進行分區。在終端窗口中輸入如下命令:
sudo fdisk /dev/sdb
如下圖所示:
在Command (m for help)提示符后面輸入m顯示一個幫助菜單。
在Command (m for help)提示符后面輸入n,執行 add a new partition 指令給硬盤增加一個新分區。
出現Command action時,輸入e,指定分區為擴展分區(extended)。
出現Partition number(1-4)時,輸入1表示只分一個區。
后續指定起啟柱面(cylinder)號完成分區。
在Command (m for help)提示符后面輸入p,顯示分區表。
系統提示如下:
Device Boot?????????????????Start????????????????End???????????????????Blocks??????????Id?????????????System
/dev/sdb1???????????????????????????1????????????26108???????????209712478+???????????5??????????Extended
在Command (m for help)提示符后面輸入w,保存分區表。
系統提示:The partition table has been altered!
在終端窗口中輸入如下命令:
sudo fdisk -l
如下圖所示:
系統已經識別了硬盤 /dev/sdb 的分區。
二、硬盤格式化 | Format hard disk
1、顯示硬盤及所屬分區情況。在終端窗口中輸入如下命令:
sudo mkfs -t ext4 /dev/sdb
說明:
-t ext4 表示將分區格式化成ext4文件系統類型。
總結
以上是生活随笔為你收集整理的linux 4t磁盘格式化,Ubuntu 16.04系统挂载4T硬盘的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux 创建分区 4t,centos
- 下一篇: V3S-Zero TF卡无法引导Linu