====== File Systems ====== ===== FAQ ===== ==== Which file system should I use? ==== If you ask this question, probably the one which is default for your distribution or ext4. Some good file systems and their usage: ^ ext4 | root, data | ^ [[btrfs]] | redundant data, file servers | ^ zfs | redundant data, file servers | ^ xfs | root, data | ^ f2fs | flash storage | ^ [[gluster|glusterfs]] | computer clusters | ^ ntfs | shared storage with windows (slow, because [[fuse]]) | ==== There's an error "out of space" but I still have space! ==== Could be that you ran out of inodes. Check with ''df -i''. ===== xfs ===== ^ get label[(https://blog.khmersite.net/2019/10/how-to-label-xfs-filesystem/)] | ''%%xfs_admin -l /dev/sdb1%%'' | ^ change label | ''%%xfs_admin -L NEWLABEL /dev/mapper/NAME%%'' | ==== empty space is still recoverable! ==== SSDs do garbage collection differently, which is why dd if=/dev/true or scrub don't work properly. * ''[[https://man7.org/linux/man-pages/man8/xfs_scrub.8.html|xfs scrub]]'' can TRIM the SSD's free space * you can use a systemd timer (''fstrim.service'' / ''fstrim.timer'') to [[https://wiki.archlinux.org/index.php/Solid_state_drive#Periodic_TRIM|TRIM periodically]] * you can enable the discard mount option to TRIM immediately after deleting a file, which slows down deleting files a fair bit. ===== ext4 ===== === init ext4 inodes on mkfs === lazy inode init makes the drive behave slowly on first mount mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/sdXY === directory index for a huge amount of files === Huge amount = >300k mount with ''dir_index'' if the error ''EXT4-fs warning (device /dev/sdx): ext4_dx_add_entry: Directory index full!'' occurs, you probably have more than 2 million files in one directory, check with $ cd /var/ $ debugfs debugfs> open /dev/sdd1 debugfs> cd log/ debugfs> htree . [...] Number of Entries (count): 508 Number of Entries (limit): 508 [...] and remedy with ''fsck.ext4 -yfD /dev/sdx1'' ([[https://noqqe.de/blog/2012/03/08/a-byte-of-ext4-directory-indexing/|source]]) ===== NTFS ===== For interoperability with Windows; is mounted with FUSE and therefore pretty slow. Use mount options ''fmask=117,dmask=007'' so the executable bit isn't set on everything. ===== exFAT ===== * [[https://unix.stackexchange.com/questions/355763/exfat-vs-ntfs-on-linux|exFAT vs NTFS on Linux]] ===== UDF ===== * [[https://askubuntu.com/questions/27936/can-and-should-udf-be-used-as-a-hard-drive-format|Can and should UDF be used as a hard drive format?]] * [[https://github.com/JElchison/format-udf|Format UDF]]