zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Copy partition Table

July 26, 2013 by Igor Drobot Leave a Comment

Copy Partitions

When replacing a failed disk you have to create partitions on the new one. Or simple copy them from the old one.

Clean and prepare new disk:

1
2
dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
parted --script /dev/sdc mklabel msdos

dd if=/dev/zero of=/dev/sdc bs=1024 count=1024 parted --script /dev/sdc mklabel msdos

Create Partitions overviews from old disk:

1
sfdisk -d /dev/sda > partitions-sda.txt

sfdisk -d /dev/sda > partitions-sda.txt

Now read in the crated partition table:

1
sfdisk /dev/sdc < partitions-sda.txt

sfdisk /dev/sdc < partitions-sda.txt

Legend:
old broken disk: /dev/sda
new working one: /dev/sdc

Filed Under: Linux Tagged With: parted, Partitioning, sfdisk