Linux磁盘管理1
實(shí)驗(yàn)01磁盤(pán)分區(qū)
?????實(shí)驗(yàn)?zāi)繕?biāo)
?????????為虛擬機(jī)添加一塊80GB、SCSI接口的硬盤(pán)
?????????劃分2個(gè)20GB的主分區(qū)剩余作為擴(kuò)展分區(qū)
?????????新建2個(gè)邏輯分區(qū)分別為2GB、10GB
?????????將第1個(gè)邏輯分區(qū)的類(lèi)型改為SWAPID 82
?????????將第2個(gè)邏輯分區(qū)的類(lèi)型改為VFATID b
?????????確認(rèn)分區(qū)無(wú)誤后保存退出
?????????使用partprobe識(shí)別新的分區(qū)表?? 【最好是重啟一次】
?????實(shí)驗(yàn)環(huán)境
在虛擬機(jī)Linux系統(tǒng)下
?????實(shí)驗(yàn)步驟
一、環(huán)境準(zhǔn)備
1.在虛擬關(guān)機(jī)狀態(tài)下添加一塊80G、SCSI硬盤(pán)
2. 使用“fdisk”命令查看新添加硬盤(pán)的屬性
[root@localhost ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 85.8 GB, 85899345920bytes
255 heads, 63 sectors/track, 10443cylinders
Units = cylinders of 16065 * 512 =8225280 bytes
?
Disk /dev/sdb doesn't contain a validpartition table
?
3.劃分分區(qū)利用“fdisk”命令進(jìn)入分區(qū)劃分模式
?[root@localhost~]# fdisk /dev/sdb
4.劃分2個(gè)20G的主分區(qū)剩余的為擴(kuò)展分區(qū)可以通過(guò)m查看幫助信息
Command (m for help): m
Command action
??a?? toggle a bootable flag
??b?? edit bsd disklabel
??c?? toggle the dos compatibilityflag
??d?? delete a partition
??l?? list known partition types
??m?? print this menu
??n?? add a new partition
??o?? create a new empty DOSpartition table
??p?? print the partition table
??q?? quit without saving changes
??s?? create a new empty Sun disklabel
??t?? change a partition's system id
??u?? change display/entry units
??v?? verify the partition table
??w?? write table to disk and exit
??x?? extra functionality (expertsonly)
Command (m for help): n??????? //n為創(chuàng)建新分區(qū)的命令
Command action
??e?? extended???????????? //e代表擴(kuò)展分區(qū)
??p?? primary partition (1-4) // p代表主分區(qū)
p
Partition number (1-4): 1?????????? //數(shù)字代表分區(qū)號(hào)
First cylinder (1-10443, default 1): //默認(rèn)柱面起始編碼
Using default value 1
Last cylinder or +size or +sizeM or+sizeK (1-10443, default 10443): +20G???????????????? //設(shè)置分區(qū)大小“+”必須帶
Command (m for help): n
Command action
??e?? extended
??p?? primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (2434-10443, default2434):
Using default value 2434
Value out of range.
Last cylinder or +size or +sizeM or+sizeK (2434-10443, default 10443): +20G
Command (m for help): n
Command action
??e?? extended
??p?? primary partition (1-4)
e
Partition number (1-4): 3
First cylinder (4867-10443, default4867):
Using default value 4867
Last cylinder or +size or +sizeM or+sizeK (4867-10443, default 10443): ?//若不設(shè)置大小默認(rèn)剩余空間全部分給此分區(qū)
Using default value 10443
4. 在擴(kuò)展分區(qū)中創(chuàng)建第1個(gè)2G邏輯分區(qū)并且修改分區(qū)類(lèi)型為SWAPID 82
Command (m for help): n
Command action
??l?? logical (5 or over)? //l代表邏輯分區(qū)
??p?? primary partition (1-4) //由于只是3個(gè)主分區(qū)這里還是會(huì)顯示你是否建立主分區(qū)若是4個(gè)則不顯示
l
First cylinder (4867-10443, default4867):
Using default value 4867
Last cylinder or +size or +sizeM or+sizeK (4867-10443, default 10443): +2G
?
Command (m for help): t?? //t表示修改分區(qū)類(lèi)型的命令
Partition number (1-5): 5
Hex code (type L to list codes): 82? //為swap的ID號(hào)
Changed system type of partition 5 to82 (Linux swap / Solaris)
?
5.在擴(kuò)展分區(qū)中創(chuàng)建第2個(gè)10G邏輯分區(qū)并且修改分區(qū)類(lèi)型為VFATID b
Command (m for help): n
Command action
??l?? logical (5 or over)
??p?? primary partition (1-4)
l
First cylinder (5111-10443, default5111):
Using default value 5111
Last cylinder or +size or +sizeM or+sizeK (5111-10443, default 10443): +10G
?
Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): b //b為vfat的ID號(hào)
Changed system type of partition 6 to b(W95 FAT32)
??6.確認(rèn)劃分正確后保存退出
Command (m for help): w? //w為保存退出 q代表退出不保存
The partition table has been altered!
?
Calling ioctl() to re-read partitiontable.
?
WARNING: If you have created or modifiedany DOS 6.x
partitions, please see the fdisk manualpage for additional
information.
Syncing disks.
?????結(jié)果驗(yàn)證
可以使用partprobe識(shí)別新的分區(qū)若還是無(wú)法顯示重啟
[root@localhost~]# fdisk -l /dev/sdb
?
Disk /dev/sdb: 85.8 GB, 85899345920bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 =8225280 bytes
?
??Device Boot????? Start???????? End????? Blocks??Id? System
/dev/sdb1?????????????? 1??????? 2433???19543041?? 83? Linux
/dev/sdb2??????????? 2434??????? 4866???19543072+? 83?Linux
/dev/sdb3??????????? 4867?????? 10443???44797252+?? 5? Extended
/dev/sdb5??????????? 4867??????? 5110????1959898+? 82? Linux swap / Solaris
/dev/sdb6??????????? 5111??????? 6327????9775521??? b? W95 FAT32
轉(zhuǎn)載于:https://blog.51cto.com/suixinerwei/1534314
總結(jié)
以上是生活随笔為你收集整理的Linux磁盘管理1的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梦到成堆的苍蝇是怎么回事
- 下一篇: 查看Linux上程序或进程用到的库