partition.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:28:53 +0200
changeset 2227 1e9323e7ec88
parent 2205 5b98c1476d30
permissions -rw-r--r--
Removed files: I don't longer have interest on topic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1888
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
======================
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 Storage partitioning
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
======================
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1888
diff changeset
     7
   :local:
1888
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
2205
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
     9
List partitions
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    10
===============
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    11
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    12
List partitions::
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    13
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    14
  $ sfdisk -l
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    15
  $ fdisk -l
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    16
  $ { echo p; echo q; } | parted /dev/sda
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    17
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    18
List active/mounted partitions::
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    19
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    20
  $ mount
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    21
  $ df -H
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    22
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    23
Backup and restore MBR
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    24
======================
1888
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
Backup MBR::
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
  $ dd if=/dev/hda of=boot.mbr bs=512 count=1
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
Restore backuped mbr::
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  $ sudo of=boot.mbr if=/dev/hda bs=512 count=1
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
Backup PC partition table::
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  $ sfdisk -d /dev/sda >partition.tbl
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
Restore PC partition table::
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  $ sfdisk /dev/sdb <partition.tbl
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
Move PC partition table from on dist to another::
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  $ sfdisk -d /dev/sda | sfdisk /dev/sdb
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
2205
5b98c1476d30 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    46
Resize partition
1888
5a71256a6315 List partitions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
================