Because of link:a342401f-b7b1-4cfa-bdf9-3abfa2ce3cf2[ext4 file system performance limitations inode limit and alternatives] you might want to create virtual disks for file storage:)
Here’s how you create a 64GiB raw image disk.img that initially takes up almost no space:
[code, bash]
truncate -s 64G andrei_disk.img
#dd if=/dev/null bs=1 seek=1024000000000 of=testdummy
mkfs -t ext4 andrei_disk.img e2label andrei_disk.img AmazingAndrei udisksctl loop-setup –file andrei_disk.img udiskctl mount -b $(findfs LABEL=AmazingAndrei)
Truncate creates the file. Then make a filesystem, assign it a label. udisksctl loop-setup
assigns a loop device Normally on a GUI linux it should be automatically mounted, however in case it doesn’t happen or you’re on a server you can use udiskctl mount
This approach is amazing because since kernels 3.1 you can have near unlimited loop devices as needed footnote:[https://unix.stackexchange.com/questions/554438/what-is-maximum-loop-devices-for-linux-kernel]
== Alternative using losetup
losetup --partscan --find --show disk.img
[code, bash]
udisksctl loop-setup -f andrei_disk.img
Returning /dev/loop
mkfs.ext4 /dev/loop0 mount -o discard /dev/loop0 /mnt/experiment du -k testdummy 1063940 testdummy /tmp# df -h /mnt Filesystem Size Used Avail Use% Mounted on /dev/loop0 938G 77M 890G 1% /mnt
/tmp# cp /boot/initrd.img /mnt /tmp# du -k testdummy 1093732 testdummy
’’' du -k testdummy 1063944 testdummy ’''
udisksctl mount -b $(findfs LABEL=AmazingAndrei) Error mounting /dev/loop1: GDBus.Error:org.freedesktop.UDisks2.Error.AlreadyMounted: Device /dev/loop1 is already mounted at `/media/lostone/AmazingAndrei'.
=== As non root using udisks2 and e2tools
sudo apt install udisks2 sudo apt install e2tools
e2ls e2cp e2mkdir e2rm … etc mke2fs
=== Extend Maximum number of loopback devices ====
|Note
No longer needed in kernels 3.1+ because it’s dynamically allocated.. Should be somewhere in the range of 2^20. So one million should be more than enough:) # vi /etc/grub.conf … kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/root rhgb quiet max_loop=64 | |
---|---|
Note | |
No longer needed in kernels 3.1+ because it’s dynamically allocated.. Should be somewhere in the range of 2^20. So one million should be more than enough:) # vi /etc/grub.conf … kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/root rhgb quiet max_loop=64 |
=== elixir Efuse
mix deps {:userfs, “~> 1.0”} sudo apt install libfuse-dev
[[zkn:91d58df7-35fa-42a3-82ce-ba6f36a02226|You might be interested n backing up with rsync]]