Help - No space left on device
So I am trying to use the Onion Omega as a very small webserver. For this purpose I wanted to move the Onion Console a level down, so the first thing presented to the user after login is "mypage.html" and then making another page for me to control the onion, using the console so that it would be at www.mypage/admin.
To do this I made a new directory in /www called admin, resulting in /www/admin. I then manually move each directory from /www to /www/admin by command "mv apps admin/"
After moving apps, bower.json, elements, fonts, images, index.html and like half of lib, I was met with the following error: Can't create/rename/move admin/lib/xxxx : No space left on device.
My device is a standard device without any USB or SD extentions. Now I'm thinking factory reset to remedy my mistake or to just delete the console all together, but all actions are blocked with the message "No space left on device".
I have no idea what my next move is. I am pretty new to linux, as all my previous experience have been limited to about 5 commands relative to a project. So any help is appreciated. A complete reset of the onion, giving me the 5 MB of space back that I had is fine with me
@Peter-Bjerg-Mogensen The following observations and suggestions may help you:
- When you use a mv command the original source files are not deleted until the files are completely written to their destination, thus you need to have enough space to accommodate both the source and the destination until the mv is complete
- An analysis of the /www directory indicates that it i quite large. In particular, the directory /www/lib/juicy-ace-editor/ace/src-min-noconflict contains several files of many kilobytes and one file of over 4.9MBytes (worker-xquery.js) - this directory and its files maybe what is giving you the problem.
- One method of performing the move you want is to first move the files to the /tmp directory which is on a different file system and has much more space free. Then move them from /tmp to where you want them.
- If this doesn't work, you could instead move them off to some other system using scp and then move them back from the other system to where you want, again using scp
Regarding recovering your Omega, to a usable state again, my best suggestion is to perform a factory reset by pressing and holding the reset button for 15 seconds - it should then be back to the state in which you originally received it. After doing the factory reset, you will need to re-perform initial setup etc. and do an oupgrade to bring it up to date. You will also need to re-install any opkg packages that you may have previously installed.
As a general comment, when space is at a premium, it is highly recommended to use a USB drive (there are some available with very small form factor) and follow the instructions given in https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs - I run like this all the time with a 32GByte USB drive and have no problems.
Hope this all helps :-)
@Kit-Bishop Thanks a lot for all the suggestions
I have no idea why all the space are hidden away in /tmp and not available (I guess this is a linux thing. I am thinking with a Windows mindset that says that everything is located on C:\ and everything share the same space).
About USB, I had planned to do this, but I've missplaced my current USB stick so I have to buy a new one. Also I believe any web related work I want on the Onion has to be placed in the /www directory? If I add the USB device how do I make sure everything works? Installing packages to the usb and not to the internal flash, same goes for www, scripts and other web apps? (Again using a windows mindset, in Linux I have no install wizard that allows me to pick an install location E:) I would prefer if everything kind of got merged into a single directory completely abstracting it away allowing me to execute commands as native as possible :)
why all the space are hidden away in /tmp
The /tmp folder is a ram disk. As the name suggest it's only intended for temporary storage. The content of /tmp folder will be cleared each time when the Omega reboots or powers off.
@Peter-Bjerg-Mogensen Don't worry about where things are when you use USB for disk space. Normally the Omega disk storage is on its 16MByte flash memory. Using USB as per the instructions, you will effectively be using the USB for disk space, everything is effectively accessible in the same logical location when using the USB.
For example, on my Omega, when I query the disk space (using the df -h command) when my USB is NOT plugged in I get:
Filesystem Size Used Available Use% Mounted on rootfs 7.7M 456.0K 7.2M 6% / /dev/root 7.3M 7.3M 0 100% /rom tmpfs 29.9M 108.0K 29.8M 0% /tmp /dev/mtdblock3 7.7M 456.0K 7.2M 6% /overlay overlayfs:/overlay 7.7M 456.0K 7.2M 6% / tmpfs 512.0K 0 512.0K 0% /dev
When the USB IS plugged in I get:
Filesystem Size Used Available Use% Mounted on rootfs 28.2G 55.0M 26.7G 0% / /dev/root 7.3M 7.3M 0 100% /rom tmpfs 29.9M 108.0K 29.8M 0% /tmp /dev/sda1 28.2G 55.0M 26.7G 0% /overlay overlayfs:/overlay 28.2G 55.0M 26.7G 0% / tmpfs 512.0K 0 512.0K 0% /dev
Note in particular the difference in space for rootfs mounted on / in each case.
@Peter-Bjerg-Mogensen A bit of further explanation in relation to the /tmp directory etc and the Linux file system(s) (I am assuming you are not highly conversant with Linux - forgive me if I am mistaken and you know this :-))
Linux can have multiple different file sytems and devices but all gets effectively merged into one overall consistent directory system starting at the / directory. Each separate file system device gets mounted within the overall directory system at a specifiable directory location (use the mount command to see where).
In the case of /tmp, this is mounted on the tempfs file system which is a file system implemented in the RAM space on the Omega at system start up - I.E. part of the RAM is used as file space and this space is made available by mounting it on the /tmp directory. Hence, being in RAM, it is not preserved over a reboot/power cycle but is usable and accessible so long as the Omega is running.
You will see from the df -h figures shown above that the Omega allocates nearly 30MBytes (of the available 64MByte) of its RAM to the tmpfs file system and hence to the /tmp directory.
@Kit-Bishop Again thanks for the information. I've had this project on the back burner for quite some time, but now I've decided to pick up the project again. Though after reading through the link you sent https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs, I'm not really sure which of the two methods to go for: pivot-overlay or pivot-root.
Based on what I've said up to this point, which of the two would you recommend me to use? To add a little more information. I do not plan to remove the USB from the Onion once its set up. But I might reboot the Onion from time to time, for whatever reason.
Again thanks for all the help in getting my little project going :)
@Peter-Bjerg-Mogensen To be honest, I am not an expert on pivot-overlay vs. pivot-root other than what is covered in https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs, but
(a) I think either would suit your requirements - I run almost exclusively with the USB mounted and pivot-overlay in use
(b) Early on it was recommended to me to use pivot-overlay rather than pivot-root - though I am not clear as to the reasons
(c) Setting up pivot-overlay is a bit simpler than setting up pivot-root
I'm relieved to read that most of us have difficulties to understand what is going on, on the onions memory (Memory Technology Device; MTD)
OpenWRT is a router OS. So most of routers do not have a hard drive (block device)
*in sens of a computer who stores data for ever.
The firmware is a file where gets extracted in a ROM (Read only memory) =
Now in several layers
**the omega-os (openWRT based) prepares the data to use ... How this could look like, I tried to explain already here on a simplified way (see also link to openWRT wiki):
*What are the differences between flash devices and block drives?
**If we have a look to the partitions now, we also can recognize what is used and produced in witch layer:
root@Omega-24CF:/# fdisk -l Disk /dev/mtdblock0: 0 MB, 131072 bytes Disk /dev/mtdblock1: 1 MB, 1150464 bytes Disk /dev/mtdblock2: 15 MB, 15429632 bytes Disk /dev/mtdblock3: 7 MB, 7929856 bytes Disk /dev/mtdblock4: 0 MB, 65536 bytes Disk /dev/mtdblock5: 16 MB, 16580608 bytes
For me everything is a bit learning by doing now. So I think to put this info's in to the wiki could help several persons. But before i do so, please correct if i see something wrong or to simplified ;)