Linux下用fdisk命令和partprobe命令不重啟系統建立分區並格式化(1)

來源:互聯網
上載者:User

Linux下用fdisk命令和partprobe命令不重啟系統建立分區並格式化(1)

由於工作的需要,最近一段時間一直在學習Linux。學習一門新的知識,我是喜歡根據謀一本書或者某一個學習視頻系統的學習,這樣可以對學習的新知識有一個系統全面的認識和瞭解。所以學習之前,買了一本鳥哥的私房菜做為參考書,開始系統的學習Linux。

根據鳥哥的建議,安裝虛擬機器時,預留了一塊空的容量用來練習分區使用。所以在虛擬機器上安裝Linux系統磁碟分割時,只劃分了一塊4G的容量掛載到根目錄“/”下,還有就是只劃分了一個2G的swap分區。還有14G的容量沒有分配。

在學習磁碟管理時,使用fdisk將剩餘的容量繼續分區。卻發現建立完分區後,無法通過partprobe重載分區。

具體操作如下所示:

1、使用fdisk建立分區

。。。。)分區操作記錄沒有儲存下來,執行w後,出現下列資訊

 
  1. Disk /dev/sda: 21.5 GB, 21474836480 bytes  
  2. 255 heads, 63 sectors/track, 2610 cylinders  
  3. Units = cylinders of 16065 * 512 = 8225280 bytes  
  4. Sector size (logical/physical): 512 bytes / 512 bytes  
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  6. Disk identifier: 0x000b604c Device Boot Start End Blocks Id System  
  7. /dev/sda1 * 1 523 4194304 83 Linux  
  8. Partition 1 does not end on cylinder boundary.  
  9. /dev/sda2 523 784 2097152 82 Linux swap / Solaris  
  10. Partition 2 does not end on cylinder boundary.  
  11. /dev/sda3 784 2610 14672345 5 Extended  
  12. /dev/sda5 784 1421 5121671 83 LinuxCommand (m for help): w  
  13. The partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙.  
  14. The kernel still uses the old table. The new table will be used at  
  15. the next reboot or after you run partprobe(8) or kpartx(8)  
  16. Syncing disks.  
  17.  

儲存建立分區,提示“裝置或資源忙”,當時就在/dev/sda硬碟上做的操作,以為該提示為正常現象,所以忽略了,繼續下一步操作。

2、通過partprobe重載分區表,避免重啟系統

 
  1. [root@stduy /]# partprobe   
  2. Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (裝置或資源忙). As a result, it may not reflect all of your changes until after reboot.  
  3. Warning: 無法以讀寫方式開啟 /dev/sr0 (唯讀檔案系統)。/dev/sr0 已按照唯讀方式開啟。  
  4. Warning: 無法以讀寫方式開啟 /dev/sr0 (唯讀檔案系統)。/dev/sr0 已按照唯讀方式開啟。  
  5. Error: 無效的分區表 - /dev/sr0 出現遞迴資料分割。 

重載分區出現的上述資訊中,當時對於警告提示“裝置或資源忙,需要重啟系統才能使更改生效”直接忽略,以為是正常現象。但是對於錯誤資訊“Error: 無效的分區表 - /dev/sr0 出現遞迴資料分割。”就有點茫然了,不過,既然提示“無效的分區表”,那我查下分區資訊。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.