Linux

Storage

Storage

Copy the partition table from one disk to another

Sometimes it is neccessary to copy the partition-table of one disk to another. Mostly this is needed when a disk should be replaced on a software-raid-array. The method described here also works for GPT-Tables.

Method for GPT Tables

Backup the table of /dev/sda

sgdisk --backup=table /dev/sda

Restore the table to the new disk

sgdisk --load-backup=table /dev/sdb

Backup and Restore from /dev/sda to /dev/sdb in one command

sgdisk -R /dev/sdb /dev/sda

Finally randomize the GUID of all partitions on the disk

sgdisk -G /dev/sdb

Method for MBR-Tables

Copy table from /dev/sda to /dev/sdb

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

If you don't see the partitions, read it again (Optional)

sfdisk -R /dev/sdb

Hardware

Hardware

Get information about hardware with inxi

Overview about the system

# inxi -pluFxxrm

In this output you will find information about partitions, operating system, resource consumption, memory usage and also information about the repositories used.

image-1605018129168.png

Operation

Operation

Copy Disk with dd using an Emergency BootISO

Introduction

You need to make a backup of an active disk to a image file, the following describes howto do this.

Problem Description

Maybe you have an SSD where S.M.A.R.T. is telling you that badblocks are starting to show up. So you need to replace the SSD with a new one. You need to create an image of the actual disk (If te badblocks are not too high you can try it).

Solution

Take a backup to an Image on the running system:

dd if=/dev/sda conv=sync,noerror bs=128k status=progress | gzip -c > YYYYMMDD-boot-disk.gz

Restore the Image File. Double Check that you use the right Device Name (/dev/sda, /dev/da0 etc.)

gunzip -c YYYYMMDD-boot-disk.gz | dd of=/dev/sda

Boot the System with the new SSD.