title: Android: how to mount filesystem in RW from within my APK? (rooted, of course)
body: <p>I'm trying to write an app that copies something to the /system partition at run time. I've already implemented the ability to run terminal commands as root by requesting SU permissions. I can run a lot of commands successfully (after granting the permission request with SuperUser). However, when I try to remount /system as read/write, nothing happens. I don't get an error or a crash, and the command seems to go through just fine, but the partition stays as read-only. Here's the command I'm running (Droid X): <code>mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system</code>, and it works just fine if I run the same command from Terminal. And here's my code to execute root commands from within my app:</p>
  
  <pre><code>String cmd = "mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system";
  Process p = Runtime.getRuntime().exec("su");
  DataOutputStream os = new DataOutputStream(p.getOutputStream());
  os.writeBytes(cmd + "\n");          
  os.writeBytes("exit\n");  
  os.flush();
  </code></pre>
  
  <p>And then I have some code that checks the stdout and stderr streamd to see what happened. Can anyone give me an idea why this doesn't work?</p>