Delete files in root folder
Moderator: Martin
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Delete files in root folder
Hello,
Action: DELETE FILES doesn't work on files in root folder. Mixplorer can.
Should I be using a root command? If so, what is it?
I rooted my old Samsung S6 with Magisk. It's running LineageOS 17.1 and I'm using Automagic's Automagic's EAP version. (I'd like to pay but I'm Googleless.)
Many thanks
Micky
Action: DELETE FILES doesn't work on files in root folder. Mixplorer can.
Should I be using a root command? If so, what is it?
I rooted my old Samsung S6 with Magisk. It's running LineageOS 17.1 and I'm using Automagic's Automagic's EAP version. (I'd like to pay but I'm Googleless.)
Many thanks
Micky
Crude but it works.
Re: Delete files in root folder
All Automagic file related action are executed with user privillege. They can't be used on root folder. Using the browse feature, and you can't find the root folder from the browse menu.
Yes, You need to execute root command, rm. You can see the manual here : http://man7.org/linux/man-pages/man1/rm.1.html
example
If you have multiple file to delete, prepare the path in list. Then loop that to create a multiple lines command in a script.
use {cmd} in the Execute Root Command.
Yes, You need to execute root command, rm. You can see the manual here : http://man7.org/linux/man-pages/man1/rm.1.html
example
Code: Select all
rm /data/local/tmp/testfile
Code: Select all
dellist = newList(
"/mnt/user/0/ramdrive/test1.txt",
"/mnt/user/0/ramdrive/test2.txt",
"/mnt/user/0/ramdrive/test3.txt");
cmd = "";
for(i in dellist)
cmd = cmd + "rm " + i + "\n";
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Delete files in root folder
Hello,
That didn't work. I get an error saying that it's a read-only file system.
I thought root with Automagic would give me total control.
Not to worry, my 'crude but it works' method does the job.
Many thanks
Micky
That didn't work. I get an error saying that it's a read-only file system.
I thought root with Automagic would give me total control.
Not to worry, my 'crude but it works' method does the job.
Many thanks
Micky
Crude but it works.
Re: Delete files in root folder
What is the path of the file that give you read-only error? Try /data/local/tmp first for safety, create a file there and try to delete it.
For /mnt/user/0/ramdrive/, that is my own RAMdrive created purposely for temporary storage. It uses RAM as the storage, so I can do many operations without causing unnecessary wear-out to my eMMC.
For /mnt/user/0/ramdrive/, that is my own RAMdrive created purposely for temporary storage. It uses RAM as the storage, so I can do many operations without causing unnecessary wear-out to my eMMC.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Delete files in root folder
Hello
/system/media/bootanimation.zip
I'm changing the boot animation on every reboot.
At the moment Automagic changes the file in a folder in /user/0 and then Mixplorer copies into /system/media
I'm easily amused.
With my Samsung S6, the battery and screen burn were issues after 5 years heavy use. The storage memory is still fine. Flash memory should have a controller which will include wear-levelling. eMMC definitely has. I can't see the storage being a problem for the lifetime of the phone.
Ramdisk? How?
Micky
/system/media/bootanimation.zip
I'm changing the boot animation on every reboot.
At the moment Automagic changes the file in a folder in /user/0 and then Mixplorer copies into /system/media
I'm easily amused.
With my Samsung S6, the battery and screen burn were issues after 5 years heavy use. The storage memory is still fine. Flash memory should have a controller which will include wear-levelling. eMMC definitely has. I can't see the storage being a problem for the lifetime of the phone.
Ramdisk? How?
Micky
Crude but it works.
Re: Delete files in root folder
Don't use rm, use mv instead (rename). If you have several boot animation, just name it as bootanimation1.zip, 2, 3, etc. And use mv to rename the one you want to use. This is safer than deleting the file.
Your /system usually mounted as ro (read-only). You can check using
So before renaming, remount the system as rw first
To revert back to original boot animation
remount maybe only needed once per every reboot, depends on your ROM
RAMdrive
In my experience and many others in other forum, the most common android hardware problem after several years is battery (of course). The second most devastating problem is eMMC, especially with those mid-class phone. 2 of my phones broken because of eMMC. Flagship usually have better eMMC (or now typically MCP/uMCP, MCP = eMMC + LPDDR, uMCP = UFS + LPDDR). Even then, it still have MTBF. My friend's Galaxy note 3 last for 5 years. Actually after 3,5 years, I have been warning her, and she still hold it. And then one day it just fail and can't save any of the data inside. Nandflash eventually degraded until it is broken down. And the problem is it take down our data with it. So I better do whatever I can to minimize the write cycle and move intensive writing to the RAM. Most users don't need it, but I use it everyday, so it benefits me.
I will call it ramdrive to avoid ambiguity, as we also have ramdisk inside kernel/boot.img. When I googling it for a long time, can't find any precise way to create it. The app from playstore also fake. After multiple try and errors, all point to tmpfs. So I use mount to find all existing tmpfs.
I got it a /storage and /mnt. After trying, I found /mnt/user/0/primary is the link to the internal virtual storage. So I can create at /mnt/user/0/ramdrive (or can be other name), and then chmod it to 777. I then create folder inside for multiple usages. MiXplorer can access this folder too as regular folder (of course root required)
To confirm that the ramdrive is real, free RAM must decreased and the files stored at there should disappear after restart. Check using
I got
tmpfs 1895020 187820 1707200 10% /mnt
/dev/block/mmcblk0p53 28144 732 26760 3% /mnt/vendor/persist
By default, tmpfs size is dynamically adjusted to the usage, up to maximum half of the usable RAM. At my phone, RAM 4GB, max is 2GB. As the tmpfs show, I use 187820 KB (around 188 MB, 10% of the max). I can restart the phone, and the files disappear, the usage back to 0%.
I don't know if all ROM has the same tmpfs on the /mnt. But if other device has the same, you can create the ramdrive using simple mkdir command and chmod it.
You can create more folder inside. Just remember that every restart, everything in this folder is nuked. That's why it is for temporary file only. Of course we can create a flow to copy the content first to internal storage, but that kinda defeat the purpose of the temporary files.
Your /system usually mounted as ro (read-only). You can check using
Code: Select all
mount | grep /system
mount | grep "/system type"
So before renaming, remount the system as rw first
Code: Select all
mount -o remount,rw /system
mv /system/media/bootanimation.zip /system/media/bootanimation.ori.zip
mv /system/media/bootanimation1.zip /system/media/bootanimation.zip
Code: Select all
mount -o remount,rw /system
mv /system/media/bootanimation.zip /system/media/bootanimation1.zip
mv /system/media/bootanimation.ori.zip /system/media/bootanimation.zip
RAMdrive
In my experience and many others in other forum, the most common android hardware problem after several years is battery (of course). The second most devastating problem is eMMC, especially with those mid-class phone. 2 of my phones broken because of eMMC. Flagship usually have better eMMC (or now typically MCP/uMCP, MCP = eMMC + LPDDR, uMCP = UFS + LPDDR). Even then, it still have MTBF. My friend's Galaxy note 3 last for 5 years. Actually after 3,5 years, I have been warning her, and she still hold it. And then one day it just fail and can't save any of the data inside. Nandflash eventually degraded until it is broken down. And the problem is it take down our data with it. So I better do whatever I can to minimize the write cycle and move intensive writing to the RAM. Most users don't need it, but I use it everyday, so it benefits me.
I will call it ramdrive to avoid ambiguity, as we also have ramdisk inside kernel/boot.img. When I googling it for a long time, can't find any precise way to create it. The app from playstore also fake. After multiple try and errors, all point to tmpfs. So I use mount to find all existing tmpfs.
Code: Select all
mount | grep tmpfs
To confirm that the ramdrive is real, free RAM must decreased and the files stored at there should disappear after restart. Check using
Code: Select all
df | grep /mnt
tmpfs 1895020 187820 1707200 10% /mnt
/dev/block/mmcblk0p53 28144 732 26760 3% /mnt/vendor/persist
By default, tmpfs size is dynamically adjusted to the usage, up to maximum half of the usable RAM. At my phone, RAM 4GB, max is 2GB. As the tmpfs show, I use 187820 KB (around 188 MB, 10% of the max). I can restart the phone, and the files disappear, the usage back to 0%.
I don't know if all ROM has the same tmpfs on the /mnt. But if other device has the same, you can create the ramdrive using simple mkdir command and chmod it.
Code: Select all
mkdir /mnt/user/0/ramdrive
chmod 777 /mnt/user/0/ramdrive
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Delete files in root folder
Okay, that's a lot to digest. I'll start with the boot animation.
I couldn't understand the grep command output.
I couldn't mount /system as rw but it worked without the word system.
So I created boot animations numbered 1 to 7 and used the cp command to copy my random choice to bootanimation.zip. This works perfectly.
The mv command worked but the above works better for me.
Thank you very much for your help.
Micky
PS should I revert back to read-only after the process? I'm guessing it's ro instead of rw but I'd appreciate your confirmation first.
I couldn't understand the grep command output.
I couldn't mount /system as rw but it worked without the word system.
So I created boot animations numbered 1 to 7 and used the cp command to copy my random choice to bootanimation.zip. This works perfectly.
The mv command worked but the above works better for me.
Thank you very much for your help.
Micky
PS should I revert back to read-only after the process? I'm guessing it's ro instead of rw but I'd appreciate your confirmation first.
Crude but it works.
Re: Delete files in root folder
grep command is to filter the result. Without grep /system, using "mount" command only will produce all of the lines output, which is confusing and hard to find the needed value.
How can you mount rw without mentioning the path? It should specify the path.
cp also works. But it will take up more write cycle, as it will rewrite the block at every change. mv only move the file at the filesystem level, use less write cycle. Although not much, I will prefer mv if I need it.
After mounted rw, I usually just leave it rw. I remember some of the ROM I use always reset this back to ro after restart, haven't checked with current one.
How can you mount rw without mentioning the path? It should specify the path.
cp also works. But it will take up more write cycle, as it will rewrite the block at every change. mv only move the file at the filesystem level, use less write cycle. Although not much, I will prefer mv if I need it.
After mounted rw, I usually just leave it rw. I remember some of the ROM I use always reset this back to ro after restart, haven't checked with current one.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Delete files in root folder
Firstly, I can only enter one line of code in the command part of the action EXECUTE ROOT COMMAND
So this is the result of:
mount | grep /system
I don't know what this means.
The result of:
mount | grep "/system type"
is nothing but the exit code is 1
So this is the result of:
mount | grep /system
I don't know what this means.
The result of:
mount | grep "/system type"
is nothing but the exit code is 1
Crude but it works.
Re: Delete files in root folder
Oh, those 2 lines are separate line. My bad, I put them in the same code block
I mean you can use one of them.
So at yours, there is no "/system type", at mine there is. This is just to filter the result, so you don't see long list as you can see above.
For multiple lines of root command, you can split them using semicolon ;.
or you can prepare the command in script before (which is what I usually do)
cmd = "mount | grep /system\nmount | grep "/system type";
then use {cmd} in the execute root command. The output will be combined.
\n is to separate the line, might not be so visible. So sometimes I purposely split it like this for readability.
exit code 1 mean some error occured. Maybe no output.

So at yours, there is no "/system type", at mine there is. This is just to filter the result, so you don't see long list as you can see above.
For multiple lines of root command, you can split them using semicolon ;.
Code: Select all
mount | grep /system; mount | grep "/system type"
cmd = "mount | grep /system\nmount | grep "/system type";
then use {cmd} in the execute root command. The output will be combined.
\n is to separate the line, might not be so visible. So sometimes I purposely split it like this for readability.
Code: Select all
cmd = "mount | grep /system" + "\n" +
"mount | grep "/system type"";
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.