fév 25 2008

Eviter le reboot après utilisation de Fdisk

Publié par dave à 12:00 sous linux


Lors de toute modification de la table des partitions, fdisk retourne souvent le message d’erreur suivant:

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.

Partprobe fourni avec le paquetage "parted" permet de contourner ce problème, évitant ainsi un reboot inutile. De la description du man:
"Partprobe est un programme qui informe le noyau de l’OS des changements de la table des partitions, en forçant sa relecture."

Mise en pratique

/dev/cciss/c0d0 pourrait être /dev/sda ou tout autre.

[root@myserver ~]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 8854.
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/cciss/c0d0: 72.8 GB, 72833679360 bytes
255 heads, 63 sectors/track, 8854 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          16      128488+  83  Linux
/dev/cciss/c0d0p2              17        1060     8385930   8e  Linux LVM
/dev/cciss/c0d0p3            1061        2104     8385930   8e  Linux LVM
/dev/cciss/c0d0p4            2105        8854    54219375    5  Extended
/dev/cciss/c0d0p5            2105        5144    24418768+  8e  Linux LVM

Command (m for help): n
First cylinder (5145-8854, default 5145):
Using default value 5145
Last cylinder or +size or +sizeM or +sizeK (5145-8854, default 8854): +1000M

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.

Nous ajoutons une nouvelle partition ici, qui reste invisible du système:

[root@myserver ~]# ls /dev/cciss/
c0d0  c0d0p1  c0d0p2  c0d0p3  c0d0p4  c0d0p5

L’exécution de partprobe relit la table des partitions et rend la nouvelle accessible:

[root@myserver ~]# partprobe
[root@myserver ~]# ls /dev/cciss/
c0d0  c0d0p1  c0d0p2  c0d0p3  c0d0p4  c0d0p5  c0d0p6

Il est maintenant possible de formater et de monter la partition sans rebooter le serveur.


No responses yet

Comments RSS

Leave a Reply

Security Code: