New answers tagged


There is no generic way to directly mount a subtree of a filesystem. But you can mount the whole filesystem somewhere, and then “copy” a subtree of the mount with a bind mount. mount /dev/foobar /media/foobar mount --bind /media/foobar/usr /usr In fstab syntax: /dev/foobar /media/foobar auto defaults 0 2 /media/foobar/usr /usr bind bind


Temporary increase tmpfs filesystem 1) Open /etc/fstab with vi or any text editor of your choice, 2) Locate the line of /dev/shm and use the tmpfs size option to specify your expected size, e.g. 512MB: tmpfs /dev/shm tmpfs defaults,size=512m 0 0 e.g. 2GB: tmpfs /dev/shm tmpfs defaults,size=2g 0 0 mount -o remount /dev/shm


I’m on an android right now so your system might be a little different but in Termux, df does not accept any options at all. df # works as expected df [FILE] # works as expected df [OPTION]… [FILE]… # No such file or directory error


As an alternative, you can do this using only POSIX: find . -type f -name "*.jpg" -exec du -sk {} \; | awk 'BEGIN{total=0};{total += $1}; END{printf "%.3f MB\n", total / 1024}' Further reading: du - estimate file space usage (POSIX) find - find files (POSIX)


find ./path/to/your/drive -type f -name '*.jpg' -exec du -ch {} + Or much faster find /path/to/your/drive -name "*.jpg" -print0 | du -ch --files0-from=- Or simply, du -ch /path/to/your/drive/*.jpg | grep total Or with help of awk, find /path/to/your/drive -iname "*.jpg" -ls | awk '{total += $7} END {print total}' On my system file size shows on ...


fallocate -l 50G big_file truncate -s 50G big_file dd of=bigfile bs=1 seek=50G count=0 As those three ways can all fill up a partition quickly. If you like use dd, usually you can try it with seek. Just set seek=file_size_what_you_need and set count=0. That will tell the system there is a file, and its size is what you set, but the system will not create ...


Other alternatives include: to change the alarm thresholds to something near or below the current usage, or to create a very small test partition with limited inodes, size, or other attributes. Being able to test things such as running into the root reserved percentage, if any, may also be handy.


The fastest way to create a file in a Linux system is fallocate: fallocate -l 50G file From man: fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks ...


The problem was which have done cache clean every hour. Configuration it to store files on tmpfs fixed the problem.


There is also the findmnt command, which can print the number of bytes or a "human" number (powers of 1024 with non-iso abbreviations, sadly): $ findmnt -no size /mnt/xyz 9.7G $ findmnt -bno size /mnt/xyz 10434699264


You can do it without the grep: df --output=target,size /mnt/xyz | awk ' NR==2 { print $2 } ' df accepts as argument the mount point; you can tell to awk too to print both the second line only (NR==2) , and the 2nd argument, $2. Or better yet, cut the target as you are not outputting it, and it becomes: df --output=size /mnt/xyz | awk ' NR==2 ' When I ...

Top 50 recent answers are included