Linux掛載磁盤

Linux掛載磁盤

解決:Disk /dev/sdb doesn't contain a valid partition table

虛擬機(jī)環(huán)境,linux系統(tǒng)下新添加了一塊硬盤

1. 虛擬機(jī)--設(shè)置--添加,選擇硬盤添加

2. 首先為磁盤創(chuàng)建文件系統(tǒng):mkfs.ext3 /dev/sdb

3. 創(chuàng)建掛載點(diǎn):mkdir /mnt/sdb

4. 掛載:mount /dev/sdb /mnt/sdb

5. fdisk -l

發(fā)現(xiàn)有問題:

Disk /dev/sdb doesn't contain a valid partition table表示數(shù)據(jù)盤未分區(qū)

6.fdisk /dev/sdb

跟著向?qū)б徊讲阶鱿氯ィㄈ绻恢涝撦斎胧裁?,就輸入“m”并回車,可以打印出菜單):

Command (m for help):m

Command action

a ? toggle a bootable flag

b ? edit bsd disklabel

c ? toggle the dos compatibility flag

d ? delete a partition

l ? list known partition types

m ? print this menu

n ? add a new partition

(后面的菜單省略,太長了)

這里我們要添加一個新的分區(qū),所以輸入“n”:

Command (m for help):n

Command action

e ? extended

p ? primary partition (1-4)

p

Partition number (1-4):1

First cylinder (1-14098, default 1):(此處直接回車)

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-14098, default 14098):(此處直接回車)

Using default value 14098

Command (m for help):p

Disk /dev/sdb: 115.9 GB, 115964116992 bytes

255 heads, 63 sectors/track, 14098 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot ? ? ?Start ? ? ? ? End ? ? ?Blocks ? Id ?System

/dev/sdb1 ? ? ? ? ? ? ? 1 ? ? ? 14098 ? 113242153+ ?83 ?Linux

現(xiàn)在可以寫入分區(qū)表了,所以輸入“w”:

Command (m for help):w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

現(xiàn)在再fdisk -l,結(jié)果正常。

卸載磁盤

直接運(yùn)行如下命令:

umount/mnt/sdb

umount [是掛載磁盤的目錄]

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容