Linux下partprobe命令的使用詳解

來源:互聯網
上載者:User

   linux上,在安裝系統之後,可否建立分區並且在不重新啟動機器的情況下系統能夠識別這些分區?

  解決方案:

  你可以使用一個叫做partprobe的工具。它包含在parted的rpm軟體包中。在Red Hat Enterprise Linux 3上他的版本是parted-1.6。 partprobe 是一個可以修改kernel中分區表的工具。可以使kernel重新讀取分區表。如下命令可以查看你的系統是否安裝了parted軟體包

  代碼如下:

  rpm -q parted

  舉例來說:

  代碼如下:

  # rpm -q parted

  parted-1.6.3-29

  你可以使用up2date命令安裝這個軟體包,如果在你的系統已經正確地註冊到RHN上了。否則你可以從光碟片上安裝這個檔案。

  你可以使用fdisk或者其他命令建立一個新的分區,然後使用partprobe命令重新讀取分區表。

  代碼如下:

  # partprobe

  這個命令執行完畢之後不會輸出任何返回資訊,你可以使用mke2fs命令在新的分區上建立檔案系統。

  在Linux中使用fdisk命令進行分區時,有時會遇到“WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table.The new table will be used at the next reboot.”這種警示資訊。如下所示

  代碼如下:

  [root@localhost ~]# fdisk /dev/sde

  The number of cylinders for this disk is set to 18928.

  There is nothing wrong with that, but this is larger than 1024,

  and could in certain setups cause problems with:

  1) software that runs at boot time (e.g., old versions of LILO)

  2) booting and partitioning software from other OSs

  (e.g., DOS FDISK, OS/2 FDISK)

  Command (m for help): p

  Disk /dev/sde: 155.6 GB, 155692564480 bytes

  255 heads, 63 sectors/track, 18928 cylinders

  Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot Start End Blocks Id System

  /dev/sde1 1 18275 146793906 5 Extended

  /dev/sde5 1 18275 146793874+ 83 Linux

  Command (m for help): n

  Command action

  l logical (5 or over)

  p primary partition (1-4)

  p

  Partition number (1-4): 2

  First cylinder (18276-18928, default 18276):

  Using default value 18276

  Last cylinder or +size or +sizeM or +sizeK (18276-18928, default 18928):

  Using default value 18928

  Command (m for help): w

  The partition table has been altered!

  Calling ioctl() to re-read partition table.

  WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

  The kernel still uses the old table.

  The new table will be used at the next reboot.

  Syncing disks.

  此時使用fdisk命令看不到建立的分區資訊,可以使用partprobe命令解決這個問題而不用重啟系統,因為partprobe可以使kernel重新讀取分區資訊,從而避免重啟系統。

  代碼如下:

  partprobe - inform the OS of partition table changes

  DESCRIPTION

  This manual page documents briefly the partprobe command.

  partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.