0

I dumped the partition layout of a disk, with:

sfdisk -d /dev/sda > part_table
cat part_table

output

label: dos
label-id: 0x0004bc49
device: /dev/sda
unit: sectors

/dev/sda1 : start=        2048, size=      131072, type=83
/dev/sda2 : start=      133120, size=      131072, type=83
/dev/sda3 : start=      264192, size=      131072, type=83
/dev/sda4 : start=      395264, size=   234045440, type=5
/dev/sda5 : start=      397312, size=      131072, type=af
/dev/sda6 : start=      530432, size=      131072, type=83
/dev/sda7 : start=      663552, size=      131072, type=83
/dev/sda8 : start=      796672, size=      131072, type=83
/dev/sda9 : start=      929792, size=      131072, type=7

Is there a way to import this partition layout into a ramdisk?

  • sfdisk can do this. sfdisk /dev/ram < part_table – doneal24 Mar 11 at 12:59
  • @DougO'Neal Can you please add this as an answer so I can accept upvote after I test it – Eduard Florinescu Mar 11 at 13:01
1

You can use the sfdisk output to create the new partition table

sfdisk /dev/ram <part_table

If you're really daring (or old-fashioned), you can also use dd

dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1
dd if=sda-mbr.bin of=/dev/ram0 bs=1 count=64 skip=446 seek=446
  • I have no /dev/ram, will come back here later when I discover why – Eduard Florinescu Mar 11 at 13:45
  • I loaded it as a module sudo modprobe brd rd_size=100000 – Eduard Florinescu Mar 11 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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