How to reload partition tables on Linux: Difference between revisions
From Leo's Notes
This page was last edited on 30 December 2021, at 04:46.
m Text replacement - "Category:Linux" to "Category:Linux{{Navbox Linux}}" |
m Added guide category |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
After changing partition information on a disk, you might need to tell Linux to reload the partition tables in order for the device partitions (eg. /dev/sda1) to show up. Below are some options to tell Linux to re-read the partition information. | |||
[[Category:Linux]] | === Ways to force Linux to re-read partition tables === | ||
{| class="wikitable" | |||
!Description | |||
!Example | |||
|- | |||
|Use <code>partprobe</code> to reload partition tables on all disks, or <code>partprobe $device</code> to reload a specific device. | |||
|{{Highlight | |||
| code = # partprobe | |||
# partprobe /dev/sda | |||
| lang = terminal | |||
}} | |||
|- | |||
|Use hdparm. <code>hdparm -z $device</code>. | |||
|{{Highlight | |||
| code = # hdparm -z /dev/sda | |||
| lang = terminal | |||
}} | |||
|- | |||
|Use partx. Alternatively, kpartx might also work, though that's usually used with device mappers. | |||
|{{Highlight | |||
| code = # partx -a /dev/sda | |||
# kpartx -a /dev/sda | |||
| lang = terminal | |||
}} | |||
|- | |||
|Interface with the kernel directly and trigger a rescan of a specific block device. | |||
|{{Highlight | |||
| code = # echo 1 > /sys/block/sda/device/rescan | |||
| lang = terminal | |||
}} | |||
|} | |||
{{Navbox Linux}} | |||
[[Category:Linux]] | |||
[[Category:Guides]] | |||
Latest revision as of 04:46, 30 December 2021
After changing partition information on a disk, you might need to tell Linux to reload the partition tables in order for the device partitions (eg. /dev/sda1) to show up. Below are some options to tell Linux to re-read the partition information.
Ways to force Linux to re-read partition tables
| Description | Example |
|---|---|
Use partprobe to reload partition tables on all disks, or partprobe $device to reload a specific device.
|
# partprobe
# partprobe /dev/sda
|
Use hdparm. hdparm -z $device.
|
# hdparm -z /dev/sda
|
| Use partx. Alternatively, kpartx might also work, though that's usually used with device mappers. | # partx -a /dev/sda
# kpartx -a /dev/sda
|
| Interface with the kernel directly and trigger a rescan of a specific block device. | # echo 1 > /sys/block/sda/device/rescan
|