在CentOS系統(tǒng)上格式化邏輯分區(qū)的方法
cnblogs 發(fā)布時(shí)間:2015-10-22 11:28:43 作者:瀟湘隱者
我要評論

這篇文章主要介紹了在CentOS系統(tǒng)上格式化邏輯分區(qū)的方法,可以解決格式化磁盤時(shí)遇到的錯(cuò)誤,需要的朋友可以參考下
磁盤容量與主分區(qū)、擴(kuò)展分區(qū)、邏輯分區(qū)的關(guān)系:
硬盤的容量=主分區(qū)的容量+擴(kuò)展分區(qū)的容量
擴(kuò)展分區(qū)的容量=各個(gè)邏輯分區(qū)的容量之和
一塊物理硬盤只能有: 一到四個(gè)主分區(qū)(但其中只能有一個(gè)是活動(dòng)的主分區(qū)),或一到三個(gè)主分區(qū),和一個(gè)擴(kuò)展分區(qū)。分別對應(yīng)hda1,hda2,hda3,hda4.
Linux 中規(guī)定,每一個(gè)硬盤設(shè)備最多能有 4 個(gè)主分區(qū)(其中包含擴(kuò)展分區(qū))構(gòu)成,任何一個(gè)擴(kuò)展分區(qū)都要占用一個(gè)主分區(qū)號碼,也就是在一個(gè)硬盤中,主分區(qū)和擴(kuò)展分區(qū)一共最多是 4 個(gè)。
我曾經(jīng)的困惑點(diǎn)是:不知道擴(kuò)展分區(qū)要占用主分區(qū)(最多可以有4個(gè))一個(gè)分區(qū)號碼。
我的總結(jié):一塊硬盤可以只設(shè)主分區(qū),這時(shí)主分區(qū)可設(shè)置4個(gè)分區(qū)號。也可以設(shè)置成主分區(qū)+邏輯分區(qū),這時(shí)也是最多4個(gè)分區(qū)號碼,但是變成了4 = 3 + 1.其中4是主分區(qū)和擴(kuò)展分區(qū)加起來最多4個(gè); 3是主分區(qū),可以小于或等于3; 1是擴(kuò)展分區(qū)號,占用了一個(gè)主分區(qū)號。從5開始到16,都是邏輯分區(qū)。如果只有一個(gè)5,則擴(kuò)展分區(qū)不再進(jìn)行分區(qū)了,那么擴(kuò)展分區(qū)就是邏輯分區(qū)了(擴(kuò)展分區(qū)的磁盤總量等于一個(gè)邏輯分區(qū)的磁盤總量)。常見的是擴(kuò)展分區(qū)被分成幾個(gè)邏輯分區(qū),用5,6,7,8等號碼標(biāo)識。
如果你在Linux系統(tǒng)中格式化磁盤時(shí)遇到如下錯(cuò)誤,那么表示你正在格式化一個(gè)擴(kuò)展分區(qū)。
[root@GETTestLNX06 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
mkfs.ext4: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
直接格式化擴(kuò)展分區(qū)是不允許的,只能格式化主分區(qū)和邏輯分區(qū)。那么那么應(yīng)該如何格式化一個(gè)擴(kuò)展分區(qū)呢,我們要么刪除該擴(kuò)展分區(qū),創(chuàng)建一個(gè)主分區(qū);要么在擴(kuò)展分區(qū)上創(chuàng)建邏輯分區(qū),如下操作所示
1: 創(chuàng)建邏輯分區(qū)
[root@GETTestLNX06 ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 5 Extended
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1-13054, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054
Command (m for help): p
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 5 Extended
/dev/sdb5 1 13054 104856192 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2:格式化邏輯分區(qū)
[root@GETTestLNX06 ~]# mkfs.ext4 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214048 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
3:將掛載信息寫入配置文件
編輯

4:掛載新建的分區(qū)
[root@GETTestLNX06 ~]# cd /
[root@GETTestLNX06 /]# mkdir u01
[root@GETTestLNX06 /]# mount -a
[root@GETTestLNX06 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_gettestlnx06-lv_root
44G 2.3G 40G 6% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 477M 33M 419M 8% /boot
/dev/sdb5 99G 60M 94G 1% /u01
[root@GETTestLNX06 /]#
硬盤的容量=主分區(qū)的容量+擴(kuò)展分區(qū)的容量
擴(kuò)展分區(qū)的容量=各個(gè)邏輯分區(qū)的容量之和
一塊物理硬盤只能有: 一到四個(gè)主分區(qū)(但其中只能有一個(gè)是活動(dòng)的主分區(qū)),或一到三個(gè)主分區(qū),和一個(gè)擴(kuò)展分區(qū)。分別對應(yīng)hda1,hda2,hda3,hda4.
Linux 中規(guī)定,每一個(gè)硬盤設(shè)備最多能有 4 個(gè)主分區(qū)(其中包含擴(kuò)展分區(qū))構(gòu)成,任何一個(gè)擴(kuò)展分區(qū)都要占用一個(gè)主分區(qū)號碼,也就是在一個(gè)硬盤中,主分區(qū)和擴(kuò)展分區(qū)一共最多是 4 個(gè)。
我曾經(jīng)的困惑點(diǎn)是:不知道擴(kuò)展分區(qū)要占用主分區(qū)(最多可以有4個(gè))一個(gè)分區(qū)號碼。
我的總結(jié):一塊硬盤可以只設(shè)主分區(qū),這時(shí)主分區(qū)可設(shè)置4個(gè)分區(qū)號。也可以設(shè)置成主分區(qū)+邏輯分區(qū),這時(shí)也是最多4個(gè)分區(qū)號碼,但是變成了4 = 3 + 1.其中4是主分區(qū)和擴(kuò)展分區(qū)加起來最多4個(gè); 3是主分區(qū),可以小于或等于3; 1是擴(kuò)展分區(qū)號,占用了一個(gè)主分區(qū)號。從5開始到16,都是邏輯分區(qū)。如果只有一個(gè)5,則擴(kuò)展分區(qū)不再進(jìn)行分區(qū)了,那么擴(kuò)展分區(qū)就是邏輯分區(qū)了(擴(kuò)展分區(qū)的磁盤總量等于一個(gè)邏輯分區(qū)的磁盤總量)。常見的是擴(kuò)展分區(qū)被分成幾個(gè)邏輯分區(qū),用5,6,7,8等號碼標(biāo)識。
如果你在Linux系統(tǒng)中格式化磁盤時(shí)遇到如下錯(cuò)誤,那么表示你正在格式化一個(gè)擴(kuò)展分區(qū)。
復(fù)制代碼
代碼如下:[root@GETTestLNX06 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
mkfs.ext4: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
直接格式化擴(kuò)展分區(qū)是不允許的,只能格式化主分區(qū)和邏輯分區(qū)。那么那么應(yīng)該如何格式化一個(gè)擴(kuò)展分區(qū)呢,我們要么刪除該擴(kuò)展分區(qū),創(chuàng)建一個(gè)主分區(qū);要么在擴(kuò)展分區(qū)上創(chuàng)建邏輯分區(qū),如下操作所示
1: 創(chuàng)建邏輯分區(qū)
復(fù)制代碼
代碼如下:[root@GETTestLNX06 ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 5 Extended
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1-13054, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054
Command (m for help): p
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
Device Boot Start End Blocks Id System
/dev/sdb1 1 13054 104856223+ 5 Extended
/dev/sdb5 1 13054 104856192 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2:格式化邏輯分區(qū)
復(fù)制代碼
代碼如下:[root@GETTestLNX06 ~]# mkfs.ext4 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214048 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
3:將掛載信息寫入配置文件
編輯
復(fù)制代碼
代碼如下:[root@GETTestLNX06 ~]# vi /etc/fstab

4:掛載新建的分區(qū)
復(fù)制代碼
代碼如下:[root@GETTestLNX06 ~]# cd /
[root@GETTestLNX06 /]# mkdir u01
[root@GETTestLNX06 /]# mount -a
[root@GETTestLNX06 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_gettestlnx06-lv_root
44G 2.3G 40G 6% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 477M 33M 419M 8% /boot
/dev/sdb5 99G 60M 94G 1% /u01
[root@GETTestLNX06 /]#
相關(guān)文章
win7系統(tǒng)電腦對U盤格式化時(shí)提示windows無法完成格式化的兩種解決方法
U盤設(shè)備可以用來儲存、拷貝、轉(zhuǎn)移數(shù)據(jù),而最近有Ghost win7用戶反映電腦對U盤格式化時(shí)提示“windows無法完成格式化”,這該怎么辦呢?本文將提供win7系統(tǒng)電腦對U盤格式化2016-06-16win8系統(tǒng)如何格式化磁盤?win8系統(tǒng)下使用Format命令來格式化磁盤的方法
Ghost Win8系統(tǒng)用戶想要格式磁盤分區(qū),最常使用的方法是直接右鍵磁盤的圖標(biāo)然后點(diǎn)擊格式化,但使用慣命令的小伙伴就會選擇Format命令來格式化磁盤,下面就來介紹下使用Form2016-05-24win10怎么創(chuàng)建或格式化分區(qū)?win10格式化分區(qū)方法
很多用戶會經(jīng)常對系統(tǒng)磁盤分區(qū)進(jìn)行清理,通常情況下會選擇刪除無用文件或格式化磁盤分區(qū),而使用格式化磁盤的用戶也不在少數(shù),而近期有部分win10用戶在格式化D盤時(shí),出現(xiàn)“2016-05-03- 為了更好地將工作和生活區(qū)分開,但在格式化c盤時(shí)卻失敗,這是怎么回事呢?這種情況怎么辦呢?本文將提供xp系統(tǒng)無法格式化c盤的問題原因及解決方法供大家了解,希望對大家有2016-04-29
Win10 D盤無法格式化怎么辦?Win10系統(tǒng)D盤無法格式化問題的解決方法
Win10 D盤無法格式化怎么辦?有朋友問到這個(gè)問題,下面小編就給大家?guī)鞼in10系統(tǒng)D盤無法格式化問題的解決方法,希望可以幫助到大家2015-12-21Mac移動(dòng)硬盤怎么格式化?Mac安裝SSD后不讀取磁盤的解決辦法
Mac移動(dòng)硬盤怎么格式化?最近發(fā)現(xiàn)一個(gè)問題,mac系統(tǒng)的電腦新裝了一塊移動(dòng)硬盤以后竟然沒辦法讀取,提示需要初始化,今天就來給大家分析Mac安裝SSD后不讀取磁盤的解決辦法,2015-12-20win10系統(tǒng)u盤寫保護(hù)無法格式化的解決方法
有朋友反映win10系統(tǒng)u盤寫保護(hù)無法格式化這可怎么辦?今天小編就為大家?guī)韜in10系統(tǒng)u盤寫保護(hù)無法格式化的解決方法,需要的朋友一起看看2015-12-09Win8系統(tǒng)下U盤無法格式化的原因分析及解決方法
U盤格式化可以快速刪除U盤上的數(shù)據(jù),清理U盤上的空間,但Win8系統(tǒng)下對U盤進(jìn)行格式化,卻格式化不了,這是怎么回事呢?本文將提供Win8系統(tǒng)下U盤無法格式化的原因分析及解決2015-12-09在Linux系統(tǒng)的VPS上對硬盤進(jìn)行分區(qū)、格式化和掛載的方法
這篇文章主要介紹了在Linux系統(tǒng)的VPS對硬盤進(jìn)行分區(qū)、格式化和掛載的方法,操作之前注意對硬盤中的數(shù)據(jù)進(jìn)行備份,需要的朋友可以參考下2015-11-09如何制作Ubuntu安裝U盤 三種制作Ubuntu安裝U盤方式
這篇文章主要教大家三種制作Ubuntu安裝U盤的方式,并且是在Windows、Mac以及Linux平臺下完成,希望對大家安裝Ubuntu有所幫助,下面就是告訴大家如何制作Ubuntu安裝U盤。2015-10-27