1、給一塊新硬碟sdb分區:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<code>[root@localhost ~]</code><code># fdisk /dev/sdb </code>
<code>歡迎使用 </code><code>fdisk</code> <code>(util-linux 2.23.2)。</code>
<code>更改将停留在記憶體中,直到您決定将更改寫入磁盤。</code>
<code>使用寫入指令前請三思。</code>
<code>Device does not contain a recognized partition table</code>
<code>使用磁盤辨別符 0x12d9a784 建立新的 DOS 磁盤标簽。</code>
<code>指令(輸入 m 擷取幫助):p</code>
<code>磁盤 </code><code>/dev/sdb</code><code>:32.2 GB, 32212254720 位元組,62914560 個扇區</code>
<code>Units = 扇區 of 1 * 512 = 512 bytes</code>
<code>扇區大小(邏輯/實體):512 位元組 / 512 位元組</code>
<code>I</code><code>/O</code> <code>大小(最小/最佳):512 位元組 / 512 位元組</code>
<code>磁盤标簽類型:dos</code>
<code>磁盤辨別符:0x12d9a784</code>
<code> </code><code>裝置 Boot Start End Blocks Id System</code>
<code>指令(輸入 m 擷取幫助):n</code>
<code>Partition </code><code>type</code><code>:</code>
<code> </code><code>p primary (0 primary, 0 extended, 4 </code><code>free</code><code>)</code>
<code> </code><code>e extended</code>
<code>Select (default p): p</code>
<code>分區号 (1-4,預設 1):1</code>
<code>起始 扇區 (2048-62914559,預設為 2048):</code>
<code>将使用預設值 2048</code>
<code>Last 扇區, +扇區 or +size{K,M,G} (2048-62914559,預設為 62914559):</code>
<code>将使用預設值 62914559</code>
<code>分區 1 已設定為 Linux 類型,大小設為 30 GiB</code>
<code>指令(輸入 m 擷取幫助):w</code>
<code>The partition table has been altered!</code>
<code>Calling ioctl() to re-</code><code>read</code> <code>partition table.</code>
<code>正在同步磁盤。</code>
備注:如果w儲存的時候提示WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙。可以試試這些:
(1)fuser -m -v -i -k /dev/sdb 和fuser -m -v -i -k /dev/sdb1 (fuser沒有安裝,用yum install psmisc安裝)
(2)partprobe /dev/sdb
(3)cat /proc/partitions
(4)甚至還試過dd if=/dev/zero of=/dev/sdb bs=1 count=8 seek=512
2、mkfs.ext4 /dev/sdb1格式化報錯:
/dev/sdb1 is apparently in use by the system; will not make a 檔案系統 here!
試了網上的方法(http://blog.51cto.com/cuchadanfan/1671337),但是并沒有看到sdb和sdb1,是以我的情況不一樣:
<code>[root@hpf-linux~]</code><code># dmsetup status</code>
<code>[root@hpf-linux~]</code><code># dmsetup remove_all</code>
3、最後的解決辦法,将centos 7預設的起始扇區2048改成4096後好了。
<code>起始 扇區 (2048-62914559,預設為 2048):4096</code>
4、mkfs.ext4 /dev/sdb1格式化,挂載,開機挂載。
本文轉自 sailikung 51CTO部落格,原文連結:http://blog.51cto.com/net881004/2053506,如需轉載請自行聯系原作者