這篇文章主要介紹了linux如何添加硬盤分區(qū)掛載,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
基本步驟:分區(qū)——格式化——掛載——寫入文件
1、首先用fdisk -l命令查看添加的硬盤名稱,可以看到sdb為新增的硬盤
[root@oracle ~]# fdisk -l Disk /dev/sdb: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x00000000 Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x0006b59c Device Boot Start End Blocks Id System /dev/sda1 * 1 39 307200 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 39 2358 18631680 83 Linux /dev/sda3 2358 2611 2031616 82 Linux swap / Solaris
2、進行分區(qū),輸入m查看提示
[root@oracle ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x09f38795. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 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): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition 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 (experts only)
分析:主要參數(shù)的解析
1. 輸入 m 顯示所有命令列示。
2. 輸入 p 顯示硬盤分割情形,打印分區(qū)表。
3. 輸入 a 設(shè)定硬盤啟動區(qū)。
4. 輸入 n 創(chuàng)建新的硬盤分割區(qū)。
4.1. 輸入 e 硬盤為[延伸]分割區(qū)(extend)。
4.2. 輸入 p 硬盤為[主要]分割區(qū)(primary)。
5. 輸入 t 改變硬盤分割區(qū)屬性?! ?/p>
t:分區(qū)系統(tǒng)id號
L:82:linux swap
83:linux
86:NTFS window分區(qū)
6. 輸入 d 刪除硬盤分割區(qū)屬性。
7. 輸入 q 結(jié)束不存入硬盤分割區(qū)屬性。
8. 輸入 w 結(jié)束并寫入硬盤分割區(qū)屬性
3、輸入n創(chuàng)建新的硬盤分區(qū)——輸入p創(chuàng)建主分區(qū)——輸入1設(shè)置一個分區(qū)——回車——回車(默認(rèn)全部空間)
Command (m for help): n Command action e extended ···擴展分區(qū) p primary partition (1-4) ···主分區(qū) p Partition number (1-4): 1 First cylinder (1-2610, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): Using default value 2610
4、輸入p查看分區(qū)情況——輸入w保存退出(一定要w保存不然無效)
Command (m for help): p Disk /dev/sdb: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x09f38795 Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
5、mkfs命令格式化磁盤
[root@oracle ~]# mkfs.ext4 /dev/sdb mkfs.ext4: invalid fragment size - /dev/sdb
6、mount命令掛載分區(qū)
[root@oracle ~]# mount /dev/sdb /oracle/ You have new mail in /var/spool/mail/root [root@oracle ~]# df -TH Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 19G 11G 7.3G 60% / tmpfs tmpfs 2.1G 74k 2.1G 1% /dev/shm /dev/sda1 ext4 297M 29M 253M 11% /boot /dev/sdb ext4 22G 47M 20G 1% /oracle
7、添加到/etc/fstab文件下保存退出否則重啟后硬盤消失
/dev/sdb /oracle ext4 defaults,noatime 0 0
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“l(fā)inux如何添加硬盤分區(qū)掛載”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計公司,關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計公司行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、網(wǎng)站設(shè)計器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
本文題目:linux如何添加硬盤分區(qū)掛載-創(chuàng)新互聯(lián)
URL地址:http://chinadenli.net/article6/ghjog.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、小程序開發(fā)、品牌網(wǎng)站制作、靜態(tài)網(wǎng)站、網(wǎng)站營銷、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容