partition.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:36:16 +0200
changeset 2229 1a0b6597e594
parent 2205 5b98c1476d30
permissions -rw-r--r--
Mark block quot in HTMLe.

.. -*- coding: utf-8; -*-

======================
 Storage partitioning
======================
.. contents::
   :local:

List partitions
===============

List partitions::

  $ sfdisk -l
  $ fdisk -l
  $ { echo p; echo q; } | parted /dev/sda

List active/mounted partitions::

  $ mount
  $ df -H

Backup and restore MBR
======================

Backup MBR::

  $ dd if=/dev/hda of=boot.mbr bs=512 count=1

Restore backuped mbr::

  $ sudo of=boot.mbr if=/dev/hda bs=512 count=1

Backup PC partition table::

  $ sfdisk -d /dev/sda >partition.tbl

Restore PC partition table::

  $ sfdisk /dev/sdb <partition.tbl

Move PC partition table from on dist to another::

  $ sfdisk -d /dev/sda | sfdisk /dev/sdb

Resize partition
================