一.查看新添加磁盤(pán)
[root@localhost /]# fdisk -l 磁盤(pán) /dev/sda:53.7 GB, 53687091200 字節(jié),104857600 個(gè)扇區(qū)Units = 扇區(qū) of 1 * 512 = 512 bytes扇區(qū)大小(邏輯/物理):512 字節(jié) / 512 字節(jié)I/O 大小(最小/最佳):512 字節(jié) / 512 字節(jié)磁盤(pán)標(biāo)簽類(lèi)型:dos磁盤(pán)標(biāo)識(shí)符:0x0009f1d1 設(shè)備 Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 5253119 2113536 82 Linux swap / Solaris/dev/sda3 5253120 104857599 49802240 83 Linux 磁盤(pán) /dev/sdb:21.5 GB, 21474836480 字節(jié),41943040 個(gè)扇區(qū)Units = 扇區(qū) of 1 * 512 = 512 bytes扇區(qū)大小(邏輯/物理):512 字節(jié) / 512 字節(jié)I/O 大小(最小/最佳):512 字節(jié) / 512 字節(jié)磁盤(pán)標(biāo)簽類(lèi)型:dos磁盤(pán)標(biāo)識(shí)符:0x12f9141b 設(shè)備 Boot Start End Blocks Id System/dev/sdb1 2048 10487807 5242880 83 Linux
二.磁盤(pán)分區(qū)
[root@localhost /]# fdisk /dev/sdb歡迎使用 fdisk (util-linux 2.23.2)。 更改將停留在內(nèi)存中,直到您決定將更改寫(xiě)入磁盤(pán)。使用寫(xiě)入命令前請(qǐng)三思。 命令(輸入 m 獲取幫助):n (n為創(chuàng)建分區(qū))Partition type: p primary (1 primary, 0 extended, 3 free) (p為主分區(qū)) e extended (e為擴(kuò)展分區(qū))Select (default p): p分區(qū)號(hào) (2-4,默認(rèn) 2):2起始 扇區(qū) (10487808-41943039,默認(rèn)為 10487808):將使用默認(rèn)值 10487808Last 扇區(qū), +扇區(qū) or +size{K,M,G} (10487808-41943039,默認(rèn)為 41943039):+5G (分區(qū)的大小)分區(qū) 2 已設(shè)置為 Linux 類(lèi)型,大小設(shè)為 5 GiB 命令(輸入 m 獲取幫助):w (w保存設(shè)置)The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 設(shè)備或資源忙.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)正在同步磁盤(pán)。
三.磁盤(pán)格式化
[root@localhost /]# partprobe /dev/sdb2 (刷新分區(qū)表)[root@localhost /]# mke2fs /dev/sdb2mke2fs 1.42.9 (28-Dec-2013)文件系統(tǒng)標(biāo)簽=OS type: Linux塊大小=4096 (log=2)分塊大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks327680 inodes, 1310720 blocks65536 blocks (5.00%) reserved for the super user第一個(gè)數(shù)據(jù)塊=0Maximum filesystem blocks=134217728040 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: 完成 正在寫(xiě)入inode表: 完成 Writing superblocks and filesystem accounting information: 完成
四.創(chuàng)建目錄并掛載分區(qū)
[root@localhost /]# mkdir /soft[root@localhost /]# mount /dev/sdb2 /soft
五.設(shè)置開(kāi)機(jī)自掛載
[root@localhost /]# vim /etc/fstab /dev/sdb2 /soft xfs defaults 0 0
六.查看掛載
[root@localhost /]# df -hT文件系統(tǒng) 類(lèi)型 容量 已用 可用 已用% 掛載點(diǎn)/dev/sda3 xfs 48G 3.7G 44G 8% /devtmpfs devtmpfs 906M 0 906M 0% /devtmpfs tmpfs 914M 80K 914M 1% /dev/shmtmpfs tmpfs 914M 8.9M 905M 1% /runtmpfs tmpfs 914M 0 914M 0% /sys/fs/cgroup/dev/sda1 xfs 497M 116M 382M 24% /boot/dev/sdb1 ext2 5.0G 11M 4.7G 1% /dvd/dev/sdb2 ext2 5.0G 10M 4.7G 1% /soft
以上就是小編為大家?guī)?lái)的Linux磁盤(pán)分區(qū)實(shí)戰(zhàn)案例(必看篇)全部?jī)?nèi)容了,希望大家多多支持VEVB武林網(wǎng)~
新聞熱點(diǎn)
疑難解答
圖片精選