Tips & Tricks on Android

Monday, January 19, 2009

Mount a filesystem read-write

Very often when you want to write files to a particular partition on ADP1, you will get a "Permission Denied" if the partition is mounted read-only.
To get around this, you need to mount the partition read-write. Typically this is done with /system partition

$ adb shell
$ su
$ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

(Replace /dev/block/mtdblock3 & /system with appropriate device path and mount point, as obtained from cat /proc/mounts)

52 comments:

  1. i got an android hero Espresso 2.2 booting from SD, and for some reason cant mount -o rw ,remount -t yaffs2 /dev/block/loop1 /system
    , command silently and no output. /system is still ro!
    grunt!

    ReplyDelete
  2. discovered a workaround : now i wanna find a version of android better than the 3 i tried, cause its so slow on my touchpro!

    ReplyDelete
  3. Please DO NOT GLOAT ..
    people need help, just as you do in asking the above question .. but you are not willing to help others ..
    what is your "workaround"? what did you do to make it work - or what did you do wrong the first time? the answers will benefit others ..
    if you do not want to share - then don't post "I HAVE MADE MINE WORK" stuff ..

    ReplyDelete
  4. How do you get access to the files? Is there a jailbreak procedure first?

    ReplyDelete
  5. if you have busybox in your device then 1 line for this:
    grep " /system " /proc/mounts | awk '{system("mount -o rw,remount -t "$3" "$1" "$2)}'

    this will take the right mount path and the right fs type from /proc/mounts and remount /system as read-write

    ReplyDelete
    Replies
    1. Thanks man you saved me a ton of time! This is the best way to do this. used your on liner then used busybox to chmod -777 system and viola it worked! Thanks

      Delete
    2. Thanks for this blog and comments. Worked greatly for me (Motorola Defy + Cynagenmod 7)

      Delete
  6. I don't have busybox, but I'll Google for it. Thanks.

    ReplyDelete
  7. @dmanbuhnik

    Doesn't work for me, but i like the method!

    ReplyDelete
  8. Hi all, I've never posted...but this is what worked for me, and I did not need anything but a TERMINAL EMULATOR on my (rooted) HTC HERO:

    from the TERM type:

    $ su
    # mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
    # CHMOD 777 /SYSTEM

    and then you can modify anything in /SYSTEM

    I used this trick to replace my BOOT ANIMATION, because I had enough perms to modify after doing the CHMOD above.

    cp /SDCARD/bootscreen/* /SYSTEM/MEDIA/bootscreen/*

    The HTC HERO with 2.1 will boot with either a BOOTANIMATION.ZIP or a BOOTSCREEN folder in /System/Media/

    I used TERMINAL EMULATOR from Android Market.
    I hope I saved someone some time! :o)

    ReplyDelete
  9. Or just install Root Explorer from the Market and click on Mount R/W...

    ReplyDelete
  10. Wow, Vlada, I should have read your comments earlier. Can't believe it was as simple as that. I used it to delete the cyanongen mod Music.apk because it was giving me problems. Sound would go off and on while playing. Now I will install the stock Music player. Thanks - ag

    ReplyDelete
  11. not working guys:

    mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

    getting following error:

    Permission denied
    $ mount: Operation not permitted

    Please help

    ReplyDelete
  12. You need root first to remount. Most phones can be rooted with adb and the bluetooth toggle trick. Google search devour root with bluetooth. Should get you root.

    ReplyDelete
  13. Looks like he needs superuser permissions, try typing su into terminal first. You should have a # symbol before the line not $

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. # mount
    mount
    rootfs / rootfs ro,relatime 0 0
    tmpfs /dev tmpfs rw,relatime,mode=755 0 0
    devpts /dev/pts devpts rw,relatime,mode=600 0 0
    proc /proc proc rw,relatime 0 0
    sysfs /sys sysfs rw,relatime 0 0
    tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
    /dev/block/mtdblock4 /system yaffs2 ro,relatime 0 0
    /dev/block/mtdblock6 /data yaffs2 rw,nosuid,nodev,relatime 0 0
    /dev/block/mtdblock5 /cache yaffs2 rw,nosuid,nodev,relatime 0 0
    /dev/block/mtdblock7 /data/HWUserData yaffs2 rw,nosuid,nodev,relatime 0 0
    hwvefs /data/hwvefs fuse.hwvefs rw,nosuid,nodev,relatime,user_id=0,group_id=0,al
    low_other 0 0
    # umount /data/HWUserData
    umount /data/HWUserData
    # mount -o rw,remount -t yaffs2 /dev/block/mtdblock7 /mnt/sdcard
    mount -o rw,remount -t yaffs2 /dev/block/mtdblock7 /mnt/sdcard
    mount: Invalid argument

    I want to mount inner space as SDcard but failed, do you know how to do to deal with it? thx

    ReplyDelete
  16. Dear All,


    First thankyou so much for the great forum we have here, I am using Huawei Ideos u8150, the fone is network locked so I played around, being a total noob I started with installing sdk, and rooted my fone using z4root, rooting was successful

    No when I try to copy a modified build.prop to the systems folder in root explorer, the file is copies but is not visible, also I have deleted the original build.prop & I am afraid to reboot the fone,

    can restoring the fone to factory settings solve this ? also how come I copy the file to system folder, it gets copied and I still cant see it ?

    I have tried pushing the file using ADB command line but the device refuses to mount (persmission denied)

    I would really be thankful to anyone who can guide a noob like me, if you dont this forum has enough reasons to love it already,

    cheers !

    ReplyDelete
  17. @**: your method worked great on my HTC MyTough4G (HTC Glacier). I did one modification though. People might want to use

    chmod -R 777 /system

    The option -R makes it that all the files and subfolders contained in the folder /system can be modified. Cheer!

    ReplyDelete
  18. In a few short years, the Google Android operating system has gained immense foothold in the smartphone market.
    best android apps

    best iphone apps

    ReplyDelete
  19. This is exactly what I was looking for, thanks!

    ReplyDelete
  20. hw to create a file system.............for android...............

    ReplyDelete
  21. I had this annoying problem... couldn't delete stuff from /cust on a huawei u8800 and in mounts i didn't find the directory, but i added some things to some files and voila. Heres what i did:
    in /proc/filesystems" I added: "nodev cust" above ext3
    then in "/proc/mounts" I wrote:
    cust /cust cust rw,relatime 0 0

    And it worked perfectly... could now delete those stupid stock apps... :-)

    ReplyDelete
  22. hello , followed ur instructions , rooted my ideos x5 with superoneclick, and trying now to give command lines through cmd to my device in adb mode in order to mount the system partition... but i still cannot give a $ su command , so i cant by result mount any file system as read - write. i was thinking if there is any other file system , except /system in device, that can be mounted as rw .
    personaly i want to get in the HWvolumeFactor.cfg
    ( /system/etc/HWvolumeFactor.cfg) so i can change the variable 60 of the headset volume. what i was trying in the command line was :
    c:/Android/android-sdk/tools/>adb shell
    $ su
    Permission denied
    $ mount -o rw, remount -t yaffs2/dev/block/mtdblock0/system
    Permission denied


    PLZ HELP ME !!!!

    ReplyDelete
  23. I have to root android emulator. I've found some articles, but I've got the same error every time! It's 'cannot create su: Out of memory'!
    What I did:
    1. adb push su /data/local
    2. adb shell
    3. #su
    4. #mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    5. # cd /system/xbin
    6. # mv su osu
    7. # cat /data/local/su > su // I've got an error!!! Cannot create su: Out of memory!
    What do I wrong?

    ReplyDelete
    Replies
    1. Just a guess,but SU is a command, try changing the output file to something else.

      WINSTON

      Delete
  24. when i tried to install fonts using some applications it gives me error 0x103 cannot install font, rooted
    mount[-r][-w][-o options][-t type] device directory

    ReplyDelete
  25. Hi ,Could you please tell how to change the file permission of a sdcard through DDMS. I have no external Andriod Device and am on Windows+Eclipse.

    ReplyDelete
  26. Will this (re)mount sdcard as r/w

    mount -o rw,remount -t yaffs2 /sdcard

    And what command can be used to determine when sdcard is mounted as r/o? To combine in cron to auto set back to r/w

    Will

    mount -o rw,remount -t yaffs2 /sdcard

    Work on Droid x? Work on all android phones?

    ReplyDelete
  27. $ adb shell
    $ su
    $ mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

    (Replace /dev/block/mtdblock3 & /system with appropriate device path and mount point, as obtained from cat /proc/mounts)


    ##I am trying to determine what mount point is the correct one based on the above advice. Below is my list of mount points. Can anyone offer advice?

    rootfs / rootfs ro,relatime 0 0
    proc /proc proc rw,relatime 0 0
    sys /sys sysfs rw,relatime 0 0
    /dev/block/stl10 /system ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc 0 0
    /dev/block/mmcblk0p3 /cache ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc 0 0
    /dev/block/stl11 /dbdata ext4 rw,noatime,barrier=0,nodelalloc,data=ordered,noauto_da_alloc 0 0
    /dev/block/mmcblk0p1 /data ext4 rw,noatime,barrier=1,data=ordered,noauto_da_alloc 0 0
    tmpfs /dev tmpfs rw,relatime,mode=755 0 0
    devpts /dev/pts devpts rw,relatime,mode=600 0 0
    none /acct cgroup rw,relatime,cpuacct 0 0
    tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
    tmpfs /mnt/radio tmpfs rw,relatime 0 0
    tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
    none /dev/cpuctl cgroup rw,relatime,cpu 0 0
    /dev/block/mmcblk0p2 /preinstall rfs rw,nosuid,nodev,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0
    /dev/block/stl3 /efs rfs rw,nosuid,nodev,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0
    /dev/block/stl7 /mnt/.lfs j4fs rw,relatime 0 0
    /sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
    /dev/block/vold/179:9 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
    /dev/block/vold/179:9 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
    tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0

    ReplyDelete
  28. it's the same mounting point that label system, in your list:
    /dev/block/stl10 /system ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc 0 0

    ReplyDelete
  29. nice, I had to try this four times because I typed /dev/block/st19 instead of /dev/block/stl9 a (1) one instead of the letter el (l) ! opps!

    ReplyDelete
  30. Thanks! My touchscreen driver broke (I tried to edit touchpad.cfg) and I couldn't get to root explorer! Luckily I ADB'd into the system and change it to my backup. The system wouldn't write (r/o) so I used your command and it works! Thanks again, everything works now!

    ReplyDelete
  31. Thanks buddy....

    I couldn't add new fonts to my android. Now via your tip, it was so helpful.

    ReplyDelete
  32. after the "su" command I get a "su: unknown user root
    I need help

    ReplyDelete
  33. I tried mounting data partition again just before shutdown in my (rooted)android device.
    Mount succeeded, but chmod and chown failed[operation not permitted]. Any idea about how to solve this?

    ReplyDelete
  34. How do mount through programmatically. Is it possible?

    ReplyDelete
  35. Thank you very much!
    For me - (from windows command prompt)

    adb shell
    mount -o rw,remount /system
    cd /system/customize/resource
    mv BoltAnimation.mp3 BoltAnimation.mp3.bak

    Now my phone doesn't shout at me if it reboots during work!

    ReplyDelete
  36. Thanks buddy....
    collect cheap jerseys
    I couldn't add new fonts to my android. Now via your tip, it was so helpful.

    ReplyDelete
  37. thank you verry much..... i never know without you.....

    ReplyDelete
  38. Ce qui sera probablement le moment le plus important de la finale de la Ligue des champions de la CONCACAF 2018 entre le TFC et Chivas de Guadalajara est arrivé à peine 63 secondes après le début du match aller. Il est arrivé avant que des milliers de spectateurs qui ont renoncé à un match éliminatoire des Raptors de Toronto pour affronter les éléments puissent s’installer confortablement. maillot de foot pas cher 2019 2020 Rodolfo Pizarro a fait confiance à Toronto et le statut préféré de TFC dans l’air glacial canadien:
    Et bien que Toronto se soit rétablie, elle n’a jamais retrouvé ce statut. Les dégâts causés par l’objectif de Pizarro n’ont jamais été totalement annulés. Par conséquent, les deux tâches sont toujours dans la file d'attente des CFC avant leur retour au Mexique pour le match retour.

    ReplyDelete
  39. Si la frappe de Pizarro était le déstabilisateur, le coup franc d’Alan Pulido, à la 72e minute, était le coup de grâce. Cela a renvoyé les TFC au Mexique, entraînant un déficit de 2-1 et deux buts de Chivas avec le but.
    Après le premier but, Toronto avait grandi dans le match. Il a commencé à reconstituer les mouvements d'attaque qui en faisaient la meilleure équipe de l'histoire de la MLS; cela l'a propulsé sur Tigres et Club America, deux des meilleures équipes du Mexique, maillot de foot pas cher 2020 en quarts de finale et en demi-finale.

    ReplyDelete
  40. Jonathan Osorio a complété l'un de ces mouvements avec un but emblématique de ce qui a permis à Toronto de s'élever au sommet de l'Amérique du Nord et centrale. Sebastian Giovinco et Jozy Altidore, les PDD et les stars du TFC, se sont alliés pour libérer Marky Delgado à droite. Delgado et Osorio, qui font partie de la fondation talentueuse construite par TFC sous ses PDD, ont obtenu le niveau de pays organisateur. maillot de foot pas cher 2019 Et Toronto a eu plusieurs occasions de prendre une avance qui aurait mis la égalité à égalité lors du retour à Guadalajara. Altidore a bien failli mettre un terme à une attaque frontale brillante:

    ReplyDelete
  41. "Piatek a marqué un but et aidé ce soir à convaincre Levy de l'acheter? Vous aimez le voir", a ajouté un autre.

    LIRE LA SUITE
    Autres nouvelles incontournables du Tottenham Hotspur FC
    Exclusif - Roberto Martinez voulait un emploi
     
    Jose regrette la pudeur de Sky Sports
     
    Kane a donné le feu vert en laiton sur Jose
     
    Exclusif - Mourinho soutenu pour remporter l'UCL
    L'arrivée de Zlatan Ibrahimovic à San Siro ce mois-ci a vu Piatek repoussé l'ordre hiérarchique et cela l'a vu devenir disponible si leur évaluation est respectée.

    Crystal Palace, Aston Villa et Newcastle sont également intéressés par l'ancien homme de Gênes, mais Tottenham détiendrait l'avantage s'il tentait de déménager en Angleterre.

    Les Spurs avaient préféré attendre l'été pour signer un attaquant pour rivaliser avec Kane - mais la blessure de leur vice-capitaine a changé leur approche de la fenêtre de janvier.

    Stefano Pioli s'est entretenu avec Milan TV après la victoire de ce soir sur SPAL en huitièmes de finale de Coppa Italia, soulignant sa satisfaction d'avoir atteint les quarts de finale: "Ce soir a été une soirée positive où tout le monde a bien fait d'être prêt pour le match."

    Après notre entraîneur, c'était au tour d'Antonio Donnarumma de parler à Club Channel après la victoire 3-0 contre l'équipe de Semplici: "Je donne toujours mon maximum à chaque séance d'entraînement, comme si je jouais un match."

    Comme toujours, Theo Hernández était au cœur des choses à San Siro, trouvant son cinquième but de la saison jusqu'à présent. Le Français a parlé de cette réalisation: "Je ne m'attendais pas à ce genre d'impact dans le football italien mais maillot de foot 2021 pas cher je veux continuer comme ça."

    ReplyDelete