3

I have a rooted samsung galaxy y phone running android 2.3.6

As a root user , I successfully created "usr" directory in / path & set permission 755. But after rebooting my phone, usr directory is not there. How it got deleted !!

Please guide me how to create it permanently in / path.

1

1 Answer 1

5

The / (root) directory is not a persistent filesystem on Android. It's a initramfs, which is packed into the boot image on your device. Although you can remount it with write permissions, changes will always be lost the next time you boot because the original ramdisk will be re-extracted from the boot image on the next boot.

In order to make a permanent change you would need to get a copy of your boot image, unpack the initramfs, make your changes, then repack everything and flash the boot image on your device. Tools like dsixda's Android Kitchen can help facilitate this. Otherwise, you can try something like mkbootimg-tools to help you get the ramdisk, then gunzip/cpio to unpack it by hand, and the reverse to repack everything.

The process - provided not much has changed in the last few years - would be something along the lines of:

$ mkboot boot.img /output-folder
$ cd /output-folder
$ gunzip -c ramdisk | cpio -i
... make some changes in the ramdisk and possibly /output-folder/img_info ...
$ find . | cpio -o -H newc | gzip > newramdisk.cpio.gz
$ cd ..
$ mkboot /output-folder newboot.img

You may need to check if there are any additional options to pass into mkboot for your specific device.

You must log in to answer this question.

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