Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is the command:

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

It fails because permission is denied and the entire error message looks like this:

/dev/sdb: Permission denied
sfdisk: cannot open /dev/sdb read-write
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.

I already tried formatting the sdb drive with disk utility or even removing the format and leaving it as unallocated space but nothing succeeded. How should I execute it? Thank you :)

PS: Ubuntu 12.04 are used

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

sudo sfdisk -d /dev/sda | sudo sfdisk --force /dev/sdb should fix the ´permission denied'. The 2nd part needs to be with the correct permissions too (the pipe cancels the previous sudo.

The comment about the warning: this warning should only be relevant if you had some old OS installed alongside ubuntu that cares about cylinder boundaries.

share|improve this answer
add comment

I would use the dd command instead.

sudo dd if=/dev/sda of=/dev/sdb
share|improve this answer
1  
I would too... but he wants to copy the partition table: "sfdisk has four (main) uses: list the size of a partition, list the partitions on a device, check the partitions on a device, and - very dangerous - repartition a device." He is after the dangerous part ;) So your dd command probably should look like this: dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1 and for restoring dd if= sda-mbr.bin of=/dev/sdb bs=1 count=64 skip=446 seek=446 –  Rinzwind Dec 4 '12 at 21:02
    
No I am not backing up. This is just a step for creating raid-1 –  George Pligor Dec 28 '12 at 9:02
add comment

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.