新聞中心
linux的分區(qū)實(shí)現(xiàn),是將多個(gè)物理硬盤,網(wǎng)絡(luò)磁盤,及其他存儲設(shè)備,抽象為一個(gè)或多個(gè)邏輯卷,用戶可以自由指定每個(gè)邏輯卷的大小。因此,Linux分區(qū)是操作系統(tǒng)中避免硬盤浪費(fèi)和文件管理混亂的很好方法。

分區(qū)操作,需要使用fdisk工具,進(jìn)入Linux終端,執(zhí)行”fdisk -l”查看當(dāng)前可分區(qū)的硬盤:
$ fdisk -l
Disk /dev/sda: 6 TB, 600037355589 bytes, 11717883720 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: 0x9fbd0556
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 4980738544 5344331775 356253224 170G 7 HPFS/NTFS/exFAT
/dev/sda2 5344332032 11717883391 6373551360 3TB 7 HPFS/NTFS/exFAT
其中,/dev/sda為可以分區(qū)的硬盤;可以看到當(dāng)前/dev/sda有兩個(gè)分區(qū),/dev/sda1和/dev/sda2。
接下來就可以執(zhí)行fdisk 進(jìn)行分區(qū)操作了,在終端內(nèi)執(zhí)行`fdisk /dev/Sda`,進(jìn)入fdisk 的交互界面:
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
在fdisk的命令菜單中,可以使用n創(chuàng)建新的分區(qū),可以指定新的分區(qū)的大小,新的分區(qū)將被創(chuàng)建在未使用的空間里:
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-11717883391, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-11717883391, default 11717883391): +10G
Created a new partition 1 of type 'Linux' and of size 10 GiB.
接下來,可以使用w將分區(qū)寫入分區(qū)表,fdisk才能生效,新的分區(qū)將被掛載:
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
最后輸入mount,新建的分區(qū)/dev/sda1就完成掛載了:
$ mount /dev/sda1 /mnt/new_partition
總的來說,Linux的分區(qū)非常簡單,只需要使用fdisk工具,按照規(guī)則進(jìn)行操作,就可以完成對硬盤的分區(qū),有效的管理硬盤以及避免硬盤浪費(fèi)。
成都服務(wù)器托管選創(chuàng)新互聯(lián),先上架開通再付費(fèi)。
創(chuàng)新互聯(lián)(www.cdcxhl.com)專業(yè)-網(wǎng)站建設(shè),軟件開發(fā)老牌服務(wù)商!微信小程序開發(fā),APP開發(fā),網(wǎng)站制作,網(wǎng)站營銷推廣服務(wù)眾多企業(yè)。電話:028-86922220
網(wǎng)站名稱:Linux分區(qū)之路:從零開始(linux分區(qū)1)
文章地址:http://fisionsoft.com.cn/article/dhedios.html


咨詢
建站咨詢
