Linux
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
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.
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
- Then you need to save the resulting file to any storage (USB stick, external disk etc.).
- Shutdown the system and replace the faulty SSD with a new one.
- Boot from a emergency disk/iso, check the links section for downloadable ISO files.
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.
Links
- https://ubuntu.com/download/server
- https://www.system-rescue.org/Download/
- https://www.ultimatebootcd.com/download.html (Only BIOS, no UEFI)
- https://www.eset.com/int/support/sysrescue/ (Malware Cleaning)
- https://www.hirensbootcd.org/download/ (If you need Windows)