I need to create partitions in OpenWrt in the available devices how to do that

Suppose the device /dev/sda2 is having 1GB memory, i need to divide that into 4 devices and assign 250 MB each, how to do that. i increased the memory of rootfs in make menuconfig targetImages->root filesystem(changed from 104 to 1024 MB).

eg:

root@OpenWrt:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1G 0 disk
/dev/sda1 8:1 0 16M 0 part /boot
/dev/sda2 8:2 0 1G 0 part /
sr0 11:0 1 1024M 0 rom

in the above i need to divide /dev/sda2 into 4 partition's like /dev/sda20 /dev/sda21 /dev/sda22 /dev/sda23 each devices should be 250 MB memory

/dev/sda2 is already a partition with a filesystem on it and mounted as "/", so you cannot partition it further. if you need 4 250MB partitions you should:

  1. set rootfs size to 250MB -> this will set /dev/sda2 to 250MB
  2. create the additional partitions you need, for example using fdisk after owrt is up and running
  3. if you want, after the additional partitions are created, create filesystems too on each and mount them.

Hi,
Thanks for your reply, i have increased the size of the rootfs image in make menuconfig target images->rootfs partition before compilation.
I just want to create partition before compilation of openwrt code, As soon as i load the image i want /dev/sda3 /dev/sda4 of size 250 Mb along with /dev/sda1 and /dev/sda2, is it possible like that ?

you'll need to prep the partition table, written to the image file, with the additional partitions.

It's probably easier to add the additional partition creation to the first boot activates, performed by the router.

am afraid it is much easier to partitioning after you installed owrt otherwise you have modify the building process to include your partition schema.

I agree but the requirement is to create a partition and compile and load, please guide me how to prepare partition table which file you want me to refer for this

no idea,

you'll need to look into the build process, perhaps the mkimage command, and where/how it's used.

this might provide some additional guidance, even though it's not openwrt. https://github.com/LibreELEC/LibreELEC.tv/blob/master/scripts/mkimage

I could image it's actually easier to write the image once, dump the partition table,
create the additional partitions, dump the partition table agan, and compare the two.

then inject the diff into all new images created.