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?

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

1 Answer 1

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
2
  • I have no /dev/ram, will come back here later when I discover why Commented Mar 11, 2019 at 13:45
  • I loaded it as a module sudo modprobe brd rd_size=100000 Commented Mar 11, 2019 at 22:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.