0

I want to create a disk image with two partition, boot partition and rootfs partition.

I want boot to be a fixed size and rootfs to be easily resizeable to fill the target device after the image is dded to it.

Resizing file system using resize2fs is trivial, but manipulating the partition table is not.

Is there a way to let rootfs partition and file system fill the whole drive safely?

3
  • It depends on which OS you're on as to which partition tools you can use. I think it's probably safer and a little easier to add another partition and mkfs on it, if that would work for your situation.
    – RobertL
    Commented Dec 4, 2015 at 3:02
  • @RobertL That's what I was thinking last night. The OS is a custom Yocto Linux and is for a embedded system. This system actually does not require a large rootfs and the large amount of data generated by the system could and maybe should be placed in a separate partition. Commented Dec 4, 2015 at 13:57
  • A separate partition also makes it easier to upgrade the OS without touching the data partition.
    – RobertL
    Commented Dec 4, 2015 at 21:17

1 Answer 1

0

Make the /boot and swap (if any) partitions the first partition(s), and / the last partition.

/ can then easily be resized to take up the rest of the disk.

If you need any other partitions, also put them before the / partition.

BTW, you might want to look into clonezilla. It can do this kind of partition resizing automatically.

2
  • "/ can then easily be resized to take up the rest of the disk." Please provide more on the easily which is what I'm asking in the question. Commented Dec 4, 2015 at 14:15
  • i thought you wanted to know how to set things up so that resizing would be easy. Anyway, you can use gparted as a graphical tool to resize partitions (it will also automatically resize the fs too), or you can use parted on he command-line, using parted's resizepart command. if you've set things up as i described above, you can just extend the rootfs to the end of the disk. You'll need to run resize2fs to resize the fs after the partition has been resized.
    – cas
    Commented Dec 4, 2015 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .