Linux Disk Management: Difference between revisions

From miki
Jump to navigation Jump to search
Line 22: Line 22:
</source>
</source>


Use '''partprobe''' to force the kernel to re-read the MBR (re-read the partition table, see [http://www.cyberciti.biz/tips/re-read-the-partition-table-without-rebooting-linux-system.html]). Or alternatively one can use '''fdisk''' to re-rewrite the same partition and force a re-read:
Use '''partprobe''' to force the kernel to re-read the MBR (re-read the partition table, see [http://www.cyberciti.biz/tips/re-read-the-partition-table-without-rebooting-linux-system.html]). Or alternatively one can use '''fdisk''' to re-rewrite the same partition and force a re-read. And that are more solutions too ([http://www.linuxquestions.org/questions/linux-general-1/re-read-partition-table-16586/]):
<source lang="bash">
<source lang="bash">
$ sudo partprobe
$ sudo partprobe
Line 29: Line 29:
Command: v
Command: v
Command: w
Command: w
# Or use blockdev
$ sudo /sbin/blockdev --rereadpt /dev/hda
# Or use sfdisk
$ sudo sfdisk -R /dev/sda
</source>
</source>

Revision as of 01:26, 11 September 2009

References

Partitions

Some CLI software:

  • fdisk
  • sfdisk
  • parted

Some examples:

$ sudo fdisk -l /dev/sda
$ sudo fdisk -l -u /dev/sda                         # Use sector as unit
$ sudo parted -l /dev/sda                           # Don't forget the sudo
$ sudo parted /dev/sda print
$ sudo parted /dev/sda unit cyl print               # Print partition table using cylinder as unit
$ sudo parted /dev/sda unit s print                 # Print partition table using sector as unit (more accurate)
$ sudo sfdisk -l -uS /dev/sda                       # Idem
$ sudo sfdisk -d /dev/sda >sda-sfidk.dump           # Dump partition in a format that can be understood by sfdisk
$ sudo sfdisk /dev/sda <sda-sfdisk.dump
$ sudo dd if=/dev/sda of=sda.mbr bs=512 count=1     # Save the MBR

Use partprobe to force the kernel to re-read the MBR (re-read the partition table, see [1]). Or alternatively one can use fdisk to re-rewrite the same partition and force a re-read. And that are more solutions too ([2]):

$ sudo partprobe
# Or use fdisk
$ sudo fdisk /dev/sda
Command: v
Command: w
# Or use blockdev
$ sudo /sbin/blockdev --rereadpt /dev/hda
# Or use sfdisk
$ sudo sfdisk -R /dev/sda