I have two questions:
What command can I use, to move a file into another docker volume?
What command can I use, to extract a file into another volume?
I have Docker running on a VPS with 160GB Disk space.
I downloaded a snapshot .tar file on that VPS and the next step would be to unpack it. However, because the unpacked file is 88GB, I added an additional volume with 100GB to my droplet.
My plan is, to move that .tar file to the 100GB volume.
And then unpack it back into the main 160 volume.
This would be the code to unpack the file:
cd /tmp
an then:
sudo tar xvC /var/lib/docker/volumes/NAME_OF_YOUR_VOLUME/_data/data/tomo/ -f 20190617.tar
But I am a newbie and I don't understand that command and don't know how it works, when you have two volumes.
This is how I solved it.
find the new volume: fdisk -l
create a new directory and then mount the volume on it: sudo mount /dev/something /new/dir
extract the .tar on that mounted directory: sudo tar xvC /new/dir -f 20190617.tar
move it to the docker volume(after making room by deleting the .tar): cp -R /var/lib/docker/volumes/...
I recently ran a report on my EC2 server and was told that it ran out of space. I deleted the csv that was partially generated from my report (it was going to be a pretty sizable one) and ran df -h and was surprised to get this output:
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 7.0G 718M 91% /
devtmpfs 15G 100K 15G 1% /dev
tmpfs 15G 0 15G 0% /dev/shm
I surprised not only by how little was available/how much space was used,(I am on the /dev/xvda1 instance) but also surprised to see 2 alternative filesystems.
To investigate what was taking so much space, I ran du -h in ~ and saw the list of all directories on the server. Their reported size in aggregate should not be even close to 7 gb...which is why I ask "what is taking up all that space??"
The biggest directory by far was the ~ directory containing 165MB all other were 30MB and below. My mental math added it up to WAY less than 7gb. (if I understand du -h correctly, all directories within ~ ought to be included within 165MB...so I am very confused how 7 gb could be full)
Anyone know what's going on here, or how I can clean up the space? Also, just out of curiosity, is there a way to utilize the devtmpfs/tmpfs servers from the same box? I am running on AWS Linux, with versions of python and ruby installed
According to this answer, it seems as though it might be because of log files getting too large. Try run the command OP mentioned in their answer, in order to find all large files: sudo find / -type f -size +10M -exec ls -lh {} \;
For me, the best option was to delete the overlay2 docker folder and to completely refresh docker to a clean state. It clears up more than 3GB in my case.
Important note: it will stop and remove your instances, so you need to rebuild them.
In order to do that, first stop the docker engine
sudo systemctl stop docker
Prune and then delete the entire docker directory (not just the overlay2 folder):
docker system prune
sudo rm -rf /var/lib/docker
Restart docker:
sudo systemctl start docker
The engine will restart without any images, containers, volumes, user created networks, or swarm state.
Additionaly you can remove snap with:
sudo apt autoremove --purge snapd
I just built an application with expressJs for an institution where they upload video tutorials. At first the videos were being uploaded to the same server but later I switched to Amazon. I mean only the videos are being uploaded to Amazon. Now I get this error whenever I try to upload ENOSPC no space left on device. I have cleared the tmp file to no avail.I need to say that I have searched extensively about this issue but none of d solutions seems to work for me
Just need to clean up the Docker system in order to tackle it. Worked for me.
$ docker system prune
Link to official docs
In my case, I got the error 'npm WARN tar ENOSPC: no space left on device' while running the nodeJS in docker, I just used below command to reclaim space.
sudo docker system prune -af
I had the same problem, take a look at the selected answer in the Stackoverflow here:
Node.JS Error: ENOSPC
Here is the command that I used (my OS: LinuxMint 18.3 Sylvia which is a Ubuntu/Debian based Linux system).
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
I have come across a similar situation where the disk is free but the system is not able to create new files. I am using forever for running my node app. Forever need to open a file to keep track of node process it's running.
If you’ve got free available storage space on your system but keep getting error messages such as “No space left on device”; you’re likely facing issues with not having sufficient space left in your inode table.
use df -i which gives IUser% like this
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 992637 537 992100 1% /dev
tmpfs 998601 1023 997578 1% /run
If your IUser% reaches 100% means your "inode table" is exhausted
Identify dummy files or unnecessary files in the system and deleted them
I got this error when my script was trying to create a new file. It may look like you've got lots of space on the disk, but if you've got millions of tiny files on the disk then you could have used up all the available inodes. Run df -hi to see how many inodes are free.
I had the same problem, you can clear the trash if you haven't already, worked for me:
(The command I searched from a forum, so read about it before you decide to use it, I'm a beginner and just copied it, I don't know the full scope of what it does exactly)
$ rm -rf ~/.local/share/Trash/*
The command is from this forum:
https://askubuntu.com/questions/468721/how-can-i-empty-the-trash-using-terminal
Well in my own case. What actually happened was while the files were been uploaded on Amazon web service, I wasn't deleting the files from the temp folder. Well every developer knows that when uploading files to a server they are initially stored in the temp folder before being copied to whichever folder you want it to(I know for Nodejs and php); So try and delete your temp folder and see. And ensure ur upload method handles clearing of your temp folder immediately after every upload
You can set a new limit temporary with:
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p
If you like to make your limit permanent, use:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Adding to the discussion, the above command works even when the program is not run from Docker.
Repeating that command:
sudo sysctl fs.inotify.max_user_watches=524288
docker system prune
The previous answers fixed my problem for a short period of time.
I had to do find the big files that weren't being used and were filling my disk.
on the host computer I run: df
I got this, my problem was: /dev/nvme0n1p3
Filesystem 1K-blocks Used Available Use% Mounted on
udev 32790508 0 32790508 0% /dev
tmpfs 6563764 239412 6324352 4% /run
/dev/nvme0n1p3 978611404 928877724 0 100% /
tmpfs 32818816 196812 32622004 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 32818816 0 32818816 0% /sys/fs/cgroup
/dev/nvme0n1p1 610304 28728 581576 5% /boot/efi
tmpfs 6563764 44 6563720 1% /run/user/1000
I installed ncdu and run it against root directory, you may need to manually delete an small file to make space for ncdu, if that's is not possible, you can use df to find the files manually:
sudo apt-get install ncdu
sudo ncdu /
that helped me to identify the files, in my case those files were in the /tmp folder, then I used this command to delete the ones that weren't used in the last 10 days:
With this app I was able to identify the big files and delete tmp files: (Sep-4 12:26)
sudo find /tmp -type f -atime +10 -delete
tldr;
Restart Docker Desktop
The only thing that fixed this for me was quitting and restarting Docker Desktop.
I tried docker system prune, removed as many volumes as I could safely do, removed all containers and many images and nothing worked until I quit and restarted Docker Desktop.
Before restarting Docker Desktop the system prune removed 2GB but after restarting it removed 12GB.
So, if you tried to run system prune and it didn't work, try restarting Docker and running the system prune again.
That's what I did and it worked. I can't say I understand why it worked.
This worked for me:
sudo docker system prune -af
Open Docker Desktop
Go to Troubleshoot
Click Reset to factory defaults
The issue was actually as a result of temp folder not being cleared after upload, so all the videos that have been uploaded hitherto were still in the temp folder and the memory has been exhausted. The temp folder has been cleared now and everything works fine now.
I struggled hard with it, some time, following command worked.
docker system prune
But then I checked the volume and it was full. I inspected and came to know that node_modules have become the real trouble.
So, I deleted node_modules, ran again NPM install and it worked like charm.
Note:- This worked for me for NODEJS and REACTJS project.
In my case, Linux ext4 file system, large_dir feature should be enabled.
// check if it's enabled
sudo tune2fs -l /dev/sdc | grep large_dir
// enable it
sudo tune2fs -O large_dir /dev/sda
On Ubuntu, ext4 FS will have a 64M limit on number of files in a single directory by default, unless large_dir is enabled.
I used to check free space first using this command.
to show show human-readable output
free -h
then i reclaimed more free space to almost
Total reclaimed space: 2.77GB from 0.94GB using this command
sudo docker system prune -af
this worked for me.
On a CentOS Linux box, when I run the following:
df-h
I get that vg_name-1v_root is at 100%.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_name-lv_root 12G 12G 0 100% /
When I drill down to /dev/mapper it looks like this vg_name-1v_root is a soft link to ../dm-0.
However i'm not able to get into vg_name-1v_root or the ../dm-0 directories.
I am able to run lsblk, vgs and lvs to view the volume, but cannot enter it or view the contents.
I've spent some time googling and searching Stack Overflow. How can I delete or even view what's in the directory /dev/mapper/vg_name-1v_root?
Many thanks in advance.
You're looking at the wrong column in the df output. That's a device, not a directory. In the Mounted on column, you see that the device is mounted on /, the root directory. It contains all of the files that aren't under any other mount point - your /bin, your /etc, your /lib, and depending on your setup, maybe your /usr, /tmp, /home... anything at the top level that you don't see listed separately in the output of df or mount.
To find out what's taking up space on that filesystem, you can run du from the root directory, using the -x option to prevent it from crossing into other filesystems.
cd /
du -x
First off, I am using Bubblewrap as the sandboxing software, but I feel like it is a general mounting issue, than a bubblewrap one. I am trying to add bwrap into a sandbox wrapper called sandboxlib, the details are not important, other than the tests that are run.
One particular test tries to mount the sandbox / from "/foo/bar". This contains 2 sub-directories, data and bin.
The bin directory simply contains a simple binary called 'test-file-is-writable'.
If I run:
$ /usr/bin/bwrap --ro-bind /foo/bar / --tmpfs /data test-file-is-writable data/1/canary
Couldn't open data/1/canary for writing.
HOWEVER, mounting / as writable works
$ /usr/bin/bwrap --bind /foo/bar / --tmpfs /data test-file-is-writable data/1/canary
Wrote data to data/1/canary.
However, I am only wanting /data to be writable, and assuming the rest of / to be ro
Adding in a remount as readonly still doesn't fix things
$ /usr/bin/bwrap --ro-bind /foo/bar / --tmpfs /data --remount-ro / test-file-is-writable data/1/canary
Couldn't open data/1/canary for writing.
Debugging this further, I added in mounts/paths required to drop into an interactive shell inside the sandbox
$ /usr/bin/bwrap --bind /foo/bar / --tmpfs /data --ro-bind /lib /lib --ro-bind /lib64 /lib64 --ro-bind /bin /usr/bin --remount-ro / bash
Running a simple ls of / shows everything is mounted as expected. Testing r/w is all fine. The issue, however, is the /data directory is totally empty (other than the output of my 'touch /data/testwrite'). Note the original /data partition I wanted to mount, actually contains files.
Q. Am I not understanding the mounting here? Or are the tests wrong?
My only work around I can see is to copy over files from the original ro /data to the newly write-mounted /data
data/1/canary is a relative path and the current directory is not the root directory, so you are trying write to somewhere else