Copy bios boot partition to other disk?

General support questions
Post Reply
klabaza
Posts: 10
Joined: 2013/11/08 00:22:38

Copy bios boot partition to other disk?

Post by klabaza » 2017/05/25 23:22:10

Hi guys.

I would like to know what is the right parameters to copy my bios boot partition 1Mb size from disk-a to disk-b, which has this layout:

Code: Select all

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02
   2            4096       199364607   95.1 GiB    FD00
   3       199364608       207761407   4.0 GiB     FD00
   4       207761408       208812031   513.0 MiB   FD00

Code: Select all

dd if=/dev/sda1 of=/dev/sdb1 bs=1Mb
Because my disk start at 2048 and ends at 4095.

Any clarification will be appreciated, thanks.

CaViCcHi
Posts: 68
Joined: 2012/04/18 17:03:15
Contact:

Re: Copy bios boot partition to other disk?

Post by CaViCcHi » 2017/05/25 23:59:49

you're really moving something that has a beginning and an end

although this assumes you have an sdb1 equally sized (actually not super sure what happens if it isn't equally sized).

probably you want something like

dd if=/dev/sda1 of=/dev/sdb seek=2048

seek because you need to skip some sectors since the beginning and I assume your blocksize is 512 (judging from your numbers)

I think that would suffice. I'd suggest first you try with of=justafile.img and then fdisk -l justafile.img or with an actual disk only if it's empty (sdb)

CaViCcHi
Posts: 68
Joined: 2012/04/18 17:03:15
Contact:

Re: Copy bios boot partition to other disk?

Post by CaViCcHi » 2017/05/26 20:09:21

anyway, I kinda forgot to say.

the dd command will literally only copy the data from the spot X to the spot Y...

then you need to create the actual partition, since it's only one I suggest you do:

Code: Select all

sfdisk -d /dev/sda > /tmp/partitiontable
then edit that file to say sdb and delete the additional partitions you don't want to create. so just leave sdb1 from 2048 size probably will say 2048

and leave the flags it has (as it should be booting). and then

Code: Select all

sfdisk /dev/sdb < /tmp/partitiontable
it is obvious that this will WIPE any partition on that disk, so this whole thing I said ASSUMES your sdb is empty. (if it isn't you should empty it first with dd)

Post Reply