1

I'm trying to create a new partition inside a .bin file via a Bash script, but I have no clue what I'm doing.

For starters, I want to preface this by saying that I am not a Linux person. I have very limited knowledge on Linux stuff.

If it matters, the .bin file I'm trying to edit is specifically a Chrome OS RMA shim for the Zork board.

It contains of 12 partitions already, a bunch of different types of files, etc.

Anyways, in my research I believe I should be using sfdisk (as I want this to be automatically performed without user input), but I cannot find a clear and concise guide on how I would actually accomplish this.

Any guides, whether for sfdisk or something else entirely I should be using instead, would be greatly appreciated.

9
  • chromium.googlesource.com/chromiumos/platform/factory/+/main/… says nothing about partitions, as expected. Why do you think you need to create a "partition inside a .bin" (like that was possible?)? Commented 9 hours ago
  • it's just cleaner if I store all the custom scripts in a separate partition Commented 8 hours ago
  • wait what do you mean you can't create a partition inside a .bin file? how the hell did the other 12 partitions get there in the first place?? Commented 8 hours ago
  • 1
    It works as a drive image file. Commented 8 hours ago
  • 2
    It might help if you could edit your question and explain why storing custom scripts in a separate partition (which would need to be mounted onto a directory under / anyway) is cleaner than simply using a directory under /. I mean, whether /custom_scripts is a simple directory or a mountpoint is mostly transparent to the system and the user, so I just don't see the benefit in cluttering your image with another partition. You already have an enormous number with 12, after all. Commented 7 hours ago

1 Answer 1

1

If it matters, the .bin file I'm trying to edit is specifically a Chrome OS RMA shim

Yes, that matters.

Apparently that .bin file is the image of a storage drive (aka "disk" image). That means that the first 512-byte block must contain an MBR sector.

In order to manipulate such a drive image and modify its partition table, you could treat this file as if it were the device node for a storage drive (e.g. /dev/sda).

So a command such as parted /dev/sda can be replaced with parted <my drive image file>.

BTW referring to this drive image file as just a .bin is confusing because more often a .bin refers to an executable file or simply an unspecified non-text file.

I'm trying to create a new partition inside a .bin file ...

the root directory already has all the shim stuff in it

Avoid conflating the concepts of partition and filesystem; they are actually two distinct concepts, and implemented/handled by different layers in the kernel.

The typical OS uses a partition as a container for a filesystem, e.g. ext4 or NTFS. A partition without an installed filesystem is not very useful.

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.