- This topic has 5 replies, 4 voices, and was last updated Aug 5-3:42 pm by anticapitalista.
August 4, 2020 at 11:12 pm #39833Memberrayluo
I’ve been using LiveUSB without any persistence. My USB disk is relatively small (4 GB), with 1 GB already consumed by the boot iso itself. But since I store very few files in ~/Live-usb-storage, I never pay attention to its disk consumption, and things still work well. Today I encountered a “No space left on device” error when copying for example a 50 MB file into it, but then the following disk space check suggests I am supposed to have still 2+ GB available. How come?
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sdb2 3.8G 1.6G 2.2G 42% /live/boot-dev /dev/loop0 1013M 1013M 0 100% /live/linux tmpfs 1.6G 2.2M 1.6G 1% /live/aufs-ram overlay 1.6G 2.2M 1.6G 1% / tmpfs 10M 0 10M 0% /media tmpfs 201M 1.1M 200M 1% /run tmpfs 10M 6.3M 3.8M 63% /live tmpfs 1003M 4.0K 1003M 1% /tmp devtmpfs 1001M 4.0K 1001M 1% /dev tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 453M 588K 452M 1% /dev/shm tmpfs 1003M 0 1003M 0% /sys/fs/cgroup tmpfs 201M 0 201M 0% /run/user/1000 /dev/sdb1 201M 512 201M 1% /media/USB-DATA /dev/sdb3 49M 4.2M 45M 9% /media/LIVE-UEFI /dev/sdc1 3.3G 3.2G 106M 97% /media/demo/DELL_PRO_64
In the first line of the above screen output, /dev/sdb2 is my USB disk. Those numbers are the same as GParted’s output (except rounding errors), although GParted also mention my sdb2 is also mounted to another 2 more mount points: /home/demo/Live-usb-storage and /root/Live-usb-storage (which shouldn’t matter here, should it?)
And, my ~/Live-usb-storage currently contains only 513M data, which still matches the “Used” stat from “df -h” (because 1GB boot iso + 513M user data ~= 1.6G used).
$ du -h -s Live-usb-storage/ 513M Live-usb-storage/
Where else should I look into to figure this out?
UPDATE: Ah, it seems I run out of inodes. Now trying to figure out why that happens, and how to fix it…
$ df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sdb2 40320 40320 0 100% /live/boot-dev /dev/loop0 159441 159441 0 100% /live/linux tmpfs 218859 1269 217590 1% /live/aufs-ram overlay 218859 1269 217590 1% / tmpfs 218859 10 218849 1% /media tmpfs 218859 645 218214 1% /run tmpfs 218859 851 218008 1% /live tmpfs 218859 17 218842 1% /tmp devtmpfs 217462 526 216936 1% /dev tmpfs 218859 2 218857 1% /run/lock tmpfs 218859 90 218769 1% /dev/shm tmpfs 218859 3 218856 1% /sys/fs/cgroup tmpfs 218859 5 218854 1% /run/user/1000 /dev/sdb1 0 0 0 - /media/USB-DATA /dev/sdb3 0 0 0 - /media/LIVE-UEFI /dev/sdc1 173252 36 173216 1% /media/demo/DELL_PRO_64 /dev/sda5 0 0 0 - /media/DATA
UPDATE 2: From what I found online, number of inodes are decided when the file system was created, and you can not change it afterwards. The default number would be disk size in KB / 16 KB. In my case, the 40320 inodes were supposed to be created for a 660MB disk (which would have been right), but my disk has 4GB. So, I don’t know whether this is considered a bug in the LiveUSB maker. Meanwhile, my workaround is to delete some less useful files from this LiveUSB disk in order to save some inodes.August 5, 2020 at 1:42 am #39841Memberskidoo
it seems I run out of inodes. Now trying to figure out why that happens, and how to fix it…
The maximum number of inodes is set when the partition is created. That max cannot be adjusted, short of reformatting the partition.
? “a bug in the LiveUSB maker”
Not a bug. A sensible default value is applied, sufficient for most (nearly all) usage scenarios.
Toward chasing down what has generated excessively many files on your sdb2:
From the top level directory, I would run the commandline utility ncdu (if not preinstalled, “sudo apt install ncdu”)
and browse through subdirectories, hunting clutter/unwanted files to remove (then, after removing “junk”, perform a remastering operation)
This prior discussion contains some housecleaning tips:
(especially post #28181 (October 17, 2019)August 5, 2020 at 11:44 am #39861Memberrayluo
Thanks for the input Skidoo.
a bug in the LiveUSB maker?
Not a bug.
If it is not a bug, I would like to know why it allocates 40320 inodes for a 4GB ext4 partition. That would effectively mean the expected average size of my files are 4GB/40320 = 100 KB/file. The default value is supposed to be tuned for 16 KB per file.
I’m not able to locate a relevant code snippet from LiveUSB maker’s source code here to find the answer.
Regardless, I have successfully use the built-in command du -d 1 –inodes to locate some folders with lots of files and remove them. This particular issue is NOT about saving space (there are more than 2 GB space left on my USB drive), it is about removing files to free up some inodes.August 5, 2020 at 12:06 pm #39863MemberBobC
At line 40 it specifies 100000 bytes per inode. Maybe that should be lower.
EXT4_OPTIONS=”-m0 -i100000 -J size=32″August 5, 2020 at 3:16 pm #39882MemberrayluoAugust 5, 2020 at 3:42 pm #39883Forum Adminanticapitalista
@rayluo – thanks for this post.
I’ll look into it.
Philosophers have interpreted the world in many ways; the point is to change it.
antiX with runit - leaner and meaner.
- You must be logged in to reply to this topic.