Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a tool that can read the partitioning information of a disk and partition another disk based on that information?

I don't know whether parted for instance can partition a disk based on a script, or whether there is a tool that can read a partition table and create a script that parted might be able to use, but I am interested in something like that if it exists.

share|improve this question
    
so we're trying to get the same sized partitions, same types, but without the content of them? –  Journeyman Geek Oct 18 '12 at 11:59
    
@JourneymanGeek yes –  vfclists Oct 18 '12 at 12:20
    
parted should do it. it can print out partitions in any unit you want, and then more invocations of parted would recreate it step by step. –  Marcin Oct 18 '12 at 14:08

1 Answer 1

I'm probably late, but anyway.. Copying partition table from sda to sdb:

Copy mbr and partition table of sda to files:

dd if=/dev/sda of=sda.mbr count=1 bs=512
sfdisk -d /dev/sda > sda.sf

Copy it from files to another drive (here sdb):

dd if=sda.mbr of=/dev/sdb
sfdisk /dev/sdb < sda.sf

If you don't need mbr skip the dd lines.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.