date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,643,300,188,000 |
Will a standard fresh linux (Ubuntu 11.10 to be exact) install and drive re-format (full) successfully TRIM my SSD, or do I need to do something extra?
I know that ext4 will TRIM blocks on erase when I specify the discard option, but I want to start with a completely TRIMmed drive if possible.
|
TRIM is a command that needs to be sent for individual blocks. I have asked the question before (What is the recommended way to empty a SSD?) and it is suggested to use ATA Secure Erase, a command that is sent to the device to clear all data.
| Will formatting my drive TRIM my SSD? |
1,643,300,188,000 |
my home directory is on a separate partition which still uses ext3. Is there a way to convert this partition into ext4 in a non-destructive way?
|
Yes, you can. This is explained very nicely in the ext4-wiki at kernel.org. Basically it all boils down to
tune2fs -O extents,uninit_bg,dir_index /dev/DEV
e2fsck -fDC0 /dev/DEV
with /dev/DEV replaced by the partition in question. Although this should be non-destructive, I'd still strongly suggest to back up your data... | Can I convert an ext3 partition into ext4 without formatting? |
1,643,300,188,000 |
I am currently using backintime to take "snapshots" of my file system. It is similar to rsnapshot in that it, makes hard links to unchanged files. I have recently run out of inodes on my EXT4 filesystem. df -hi reveals I have used 9.4 million inodes. A rough count of the number of current directories times the number ... |
That is a really bad idea. Every inode consumes 256 bytes (may be configured as 128). Thus just the inodes would consume 1TiB of space.
Other file systems like btrfs can create inodes dynamically. Use one of them instead.
| Drawbacks of increasing number of inodes in EXT4 |
1,643,300,188,000 |
When running this script:
#!/usr/bin/env python3
f = open("foo", "w")
f.write("1"*10000000000)
f.close()
print("closed")
I can observe the following process on my Ubuntu machine:
The memory fills with 10GB.
The Page Cache fills with 10GB of dirty pages. (/proc/meminfo)
"closed" is printed and the script terminates.
A... |
That sounds like a reminder of the O_PONIES fiasco, which just recently had its 11th birthday.
Before ext4 came, ext3 had acquired a sort of a reputation for being stable in the face of power losses. It seldom broke, it seldom lost data from files. Then, ext4 added delayed allocation of data blocks, meaning that it di... | Why does closing a file wait for sync when overwriting a file, but not when creating? |
1,643,300,188,000 |
Why don't ext2/3/4 need to be defragmented? Is there no fragmentation at all?
|
Modern filesystems, particularly those designed to be efficient in multi-user and/or multi-tasking use cases, do a good fairly job of not fragmenting data until filesystems become near to full (there is no exact figure for where the "near to full" mark is as it depends on how large the filesystem is, the distribution ... | Defragging an ext partition? |
1,397,407,725,000 |
I searched but couldn't find anything - I am looking for a breakdown of the file structure of a symlink in bytes, in a ext filesystem.
I have tried creating a symlink file and then using hexdump on the symlink, but it complains that it's a directory (the link was to a folder) so it's obviously trying to dump the file/... |
You didn't provide additional details, so this explanation is for the moment centered on the EXT file systems common in Linux.
If you look at the "size" of a symlink as provided by e.g. ls -l, you will notice that the size is just as large as the name of the target it is pointing to is long. So, you can infer that the... | Actual content of a symlink file |
1,397,407,725,000 |
In mount man page errors=remount-ro is an option for mounting fat but this option doesn't appear in ext4 options catalog.
I know what this option means: In case of mistake remounting the partition like readonly but I don't know if it's a correct option or only a bug.
|
It is perfectly valid for ext4, and is defined in the ext4 manpage:
errors={continue|remount-ro|panic}
Define the behavior when an error is encountered. (Either
ignore errors and just mark the filesystem erroneous and
continue, or remount the filesystem read-only, or panic and
... | Why do I have "errors=remount-ro" option in my ext4 partition in my Linux? |
1,397,407,725,000 |
Can we confirm the log message "recovering journal" from fsck should be interpreted as indicating the filesystem was not cleanly unmounted / shut down the last time? Or, are there other possible reasons to be aware of?
May 03 11:52:34 alan-laptop systemd-fsck[461]: /dev/mapper/alan_dell_2016-fedora: recovering journa... |
The “recovering journal” message is output by e2fsck_run_ext3_journal, which is only called if ext2fs_has_feature_journal_needs_recovery indicates that the journal needs recovery. This “feature” is a flag which is set by the kernel whenever a journalled Ext3/4 file system is mounted, and cleared when the file system i... | Does "recovering journal" prove an unclean shutdown/unmount? |
1,397,407,725,000 |
I am building a disk image for an embedded system (to be placed on an 4GB SD card). I want the system to have two partitions. A 'Root'(200Mb), and a 'Data' partition(800Mb).
I create an empty 1GB file with dd.
Then I use parted to set up the partitions.
I mount them each in a loop device then format them; ext2 for '... |
Firstly, writing a sparse image to a disk will not result in anything but the whole of the size of that image file - holes and all - covering the disk. This is because handling of sparse files is a quality of the filesystem - and a raw device (such as the one to which you write the image) has no such thing yet. A spar... | How do I create small disk image with large partitions |
1,397,407,725,000 |
Debian on external USB SSD drive. There was some error in dmesg log file:
...[ 3.320718] EXT4-fs (sdb2): INFO: recovery required on readonly filesystem
[ 3.320721] EXT4-fs (sdb2): write access will be enabled during recovery
[ 5.366367] EXT4-fs (sdb2): orphan cleanup on readonly fs
[ 5.366375] EXT4-fs (sdb... |
You can instruct the filesystem to perform an immediate fsck upon being mounted like so:
Method #1: Using /forcefsck
You can usually schedule a check at the next reboot like so:
$ sudo touch /forcefsck
$ sudo reboot
Method #2: Using shutdown
You can also tell the shutdown command to do so as well, via the -F switch:
... | How to repair a file system corruption? |
1,397,407,725,000 |
Recently I accidentally formatted an EXT4 partition to FAT. I got into a panic. After a long journey through a dark wood in which my hope was fading I could recover my partition and it seems ok. After sudo mke2fs -n /dev/sdx introduced some superblocks I picked up one and ran sudo e2fsck -b a_block_number /dev/sdxy an... |
All backup superblocks are the same. They are all a copy of the superblock, and are scattered throughout the disk to provide redundancy in case a large contiguous part of the disk is corrupted.
Formatting a partition, even with the same filesystem type, clears the superblock. (It makes sense: the purpose of formatting... | Difference between backup superblocks |
1,397,407,725,000 |
We have four identical Linux servers with a large (5T) hard disk partition. We have Scientific Linux with this kernel:
Linux s3.law.di.unimi.it 2.6.32-358.18.1.el6.x86_64 #1 SMP Tue Aug 27 14:23:09 CDT 2013 x86_64 x86_64 x86_64 GNU/Linux
The servers are identically configured, installed, etc. But one, and only one of... |
It was the kernel. We were using 2.6.32, which is quite old, but it is the one supported by Red Hat EL and Scientific Linux.
Today I had lunch with a friend (Giuseppe Ottaviano) who had a similar experience tuning high-performance indexing algorithms. After upgrading to the newest version everything (compiler, librari... | Large ext4 partition ridiculously slow when writing |
1,397,407,725,000 |
I need to shrink a large ext4 volume, and I would like to do it with as little downtime as possible. With the testing I've done so far it looks like it could be unmounted for the resize for up to a week. Is there any way to defragment the filesystem online ahead of time so that resizefs won't have to move so many bloc... |
From what I can tell, ext4fs supports online defragmentation (it's listed under "done", but the status field is empty; the original patch is from late 2006) through e4defrag in e2fsprogs 1.42 or newer which when running on Linux 2.6.28 or newer allows you to query status for directories or possibly file systems, and a... | Decrease time to shrink ext4 filesystem |
1,397,407,725,000 |
I am aware that there are several questions concerning how much space to reserve on a filesystem using tune2fs -m, but some of the advice is contradictory, some seems to be relevant only to the filesystem where root is mounted, and none seems to be specifically for ext4.
The drive I'm enquiring about is a 3 TB hybrid ... |
This reserve is primarily for the core system partitions so that root can still log in if a regular user manages to fill the drive and clog up the works. The space is needed for temp files, copying, and general elbow room for shell commands.
None is strictly needed on simple user data volumes. 5% on large modern drive... | tune2fs - how much space to reserve on large ext4 filesystem |
1,397,407,725,000 |
Here is the relevant line from my /etc/fstab file:
UUID=f51aa298-9ce4-4a19-a323-10df333f34f5 / ext4 data=writeback,noatime,barrier=0,errors=remount-ro,commit=100,nobh,nouser_xattr 0 1
Here is what happens when I type the command "mount":
/dev/sda1 on / type ext4 (rw,noatime,data=writeback... |
Got it.
It seems the problem was with the /usr/lib/pm-utils/power.d/journal-commit file. I edited the above file as root and changed the line
JOURNAL_COMMIT_TIME_AC=${JOURNAL_COMMIT_TIME_AC:-0}
to be
JOURNAL_COMMIT_TIME_AC=${JOURNAL_COMMIT_TIME_AC:-100}
And that's all!
P.S - I have no idea why the script ignores co... | ext4 overrides my commit=100 mount option with commit=0 |
1,397,407,725,000 |
I need to enable the case insensitive filesystem feature (casefold) on ext4 of a Debian 11 server with a backported 6.1 linux kernel with the required options compiled in.
The server has a swap partition of 2GB and a big ext4 partition for the filesystem, which it also boots from. I only have ssh access as root and ca... |
I like your approach; it's clean in that it doesn't require modification of the data on your main system.
And, yes, I think that if you want to run tune2fs then by a large margin, the easiest solution is to run that from a running Linux, so that there's no real way around having to run it when the main file system isn... | How to change the casefold ext4 filesystem option of the root partition, if I only have ssh access |
1,397,407,725,000 |
I have Linux installed on a Dell XPS 9343 with an Samsung PM851 SSD.
I recently read that many SSDs don't support TRIM operations.
So I'd like to check if discard option effectively works on my system.
At first step, I tried to simply run sudo fstrim --verbose --all and it reported 41GB trimmed; this makes me fear bec... |
as @meuh pointed out in the comment, I need to run the test on my EXT4 partition, while I tried it on my /tmp
SOLVED!
PS: following the test result, I can confirm that the drive on my XPS 9343 (Samsung PM851 M.2 2280 256GB, firmware revision: EXT25D0Q) supports TRIM command, even if dmesg reports NCQ Send/Recv Log no... | How do I check TRIM? |
1,397,407,725,000 |
I wanted to create live bootable USB of gparted via unetbootin. But by mistake I specified the device of USB as a partition of external HDD rather than the USB drive. I deleted all the files that unetbootin created in that HDD partition except one named "ldlinux.sys". I failed to do that via root user also. I'm unable... |
Could be that:
The immutable flag is set. As PM 2Ring pointed out - you can use the lsattr ldlinux.sys command and look for the 'i' flag. If this is the case, a chattr -i should remove it.
The filesystem is mounted read only (take at look at the output for the mount command)
Reference:
chattr wikipedia page
| Unable to delete file "ldlinux.sys" from a partition |
1,397,407,725,000 |
Is there any limit for the maximum nested directories in the ext4 filesystem? For example ISO-9660 filesystem AFAIK cannot have more than 7 level of sub-directories.
|
There isn’t any limit inherent in the file system design itself, and experimentation (thanks ilkkachu) shows that directories can be nested to a depth exceeding limits one might naïvely expect (PATH_MAX, 4096 on Linux, although that limits the length of paths passed to system calls and can be worked around with relati... | Nested directory depth limit in ext4 |
1,397,407,725,000 |
Does anyone have documentation on ext4-rsv-conver?
$ pgrep -a -f ext4-rsv-conver
153 ext4-rsv-conver
161 ext4-rsv-conver
7451 ext4-rsv-conver
$ dpkg -S ext4-rsv-conver
dpkg-query: no path found matching pattern *ext4-rsv-conver*
I can't find anything about ext4-rsv-conver in Google.
My system is Debian 9.
|
These processes are kernel threads, used by the ext4 implementation to handle conversion work from writeback, i.e. “completed IOs that need unwritten extents handling and have transaction reserved”.
That probably doesn’t explain much, but it does mean they’re nothing to worry about. Basically the kernel ends up with w... | What is "ext4-rsv-conver" process? |
1,397,407,725,000 |
When rsyncing a directory to a freshly plugged-in external USB flash drive, via
rsync -av /source/ /dest/
all files get transferred (i.e. rewritten) despite no changes in the files.
Note that overwriting the files only takes place once the USB is un- and replugged. Doing the rsync command twice in a row without unplu... |
Your FAT drive can store timestamps only to two second accuracy. When you unplug and replug the drive you effectively break all the file times. See the --modify-window option for a workaround:
rsync -av --modify-window=1 /source/ /dest/
Secondly, you're never going to see fast backups with rsync like this, because wh... | rsync to USB flash drive always transferring all data |
1,397,407,725,000 |
I need to detect a filesystem type from a C/C++ program using the filesystem superblock. However, I don't see much differences between superblocks for ext2 and ext4. The s_rev_level field is the same (=1), the s_minor_rev_level is the same (=0).
I could check some features from s_feature_compat (and other feature fiel... |
After looking at the code for various utilities and the kernel code for some time, it does seem that what @Hauke suggested is true - whether a filesystem is ext2/ext3/ext4 is purely defined by the options that are enabled.
From the Wikipedia page on ext4:
Backward compatibility
ext4 is backward compatible with ext3 a... | Reliable way to detect ext2 or ext3 or ext4? |
1,397,407,725,000 |
I understand that I can list the location of a filesystem's superblocks using the following commands.
Example
First get the device handle for the current directory.
$ df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_greeneggs-home 402G 146G 236G 39% /home
Then use thi... |
I'm not sure how you can examine any particular superblock, but you can use this command to examine the general contents that all the superblocks share like so, using dumpe2fs.
$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less
Example
$ sudo dumpe2fs /dev/mapper/fedora_greeneggs-home | less
Filesystem volume n... | How can I dump the contents of a filesystem's superblock? |
1,397,407,725,000 |
I'm running Debian/Testing, with kernel 4.4:
# uname -a
Linux shaula 4.4.0-1-amd64 #1 SMP Debian 4.4.6-1 (2016-03-17) x86_64 GNU/Linux
So I want to use the lazytime mount option, which is why I put the following in my /etc/fstab:
# grep vg_crypt-root /etc/fstab
/dev/mapper/vg_crypt-root / ext4 lazytime,errors=... |
Good news: it's expected.
The lazytime flag is independent of strictatime/relatime/noatime. And
the default is relatime. So when you replaced noatime with lazytime,
it's not surprising that you saw the relatime mount option being set.
-- Ted Ts'o
Unfortunately this doesn't explain what it means.
A literal read... | Why is EXT4 filesystem mounted with both relatime and lazytime |
1,397,407,725,000 |
Recently I installed Debian Squeeze, first using ext3 and then again using ext4 on the same machine. The automatic fsck done after a certain number of mounts is much faster using ext4 (about 1 min) than ext3 (about 5 min).
What are the reasons for this significant difference in speed? If ext4 is much faster why does t... |
That's one of the most advertised benefits of ext4 (see it mentioned in the Features on Wikipedia).
The reason? Filesystem developers worked hard to achieve this.
Here's a short summary quoted from Wikipedia:
Faster file system checking
In ext4, unallocated block groups and sections of the inode table are marked as ... | Significant difference in speed between fsck using ext3 and ext4 on Debian Squeeze |
1,397,407,725,000 |
Is it possible to change a file "Birth date" (according to the stat file "Birth" field)?
I can change the modification/access time with touch -t 200109110846 file, but can't find the corresponding option for "Birth".
|
Like the last change time, the birth time isn’t externally controllable. On file systems which support it, the birth timestamp is set when a file is created, and never changes after that.
If you want to control it, you need to change the system’s notion of the current date and time, and create a new file.
| Change file "Birth date" for ext4 files? |
1,397,407,725,000 |
I have a problem with removing empty dir, strace shows error:
rmdir("empty_dir") = -1 ENOTEMPTY (Directory not empty)
And ls -la empty_dir shows nothing. So i connected to the fs (ext4) with debugfs and see the hidden file inside this dir:
# ls -lia empty_dir/
total 8
44574010 drwxr-xr-x 2 2686 2681 4096 Jan 13 17:59... |
I straced ls and got more information to dig (stripped non-important syscalls):
open("empty_dir", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 3 entries */, 32768) = 80
write(1, ".\n", 2.) = 2
write(1, "..\n", 3..) = 3
Hmm, we see that syscall getdents works ... | rmdir failed to remove empty directory |
1,397,407,725,000 |
So en route from my old laptop to a new one my old laptop's hard drive got some physical damage. badblocks reports 64 bad sectors. I had a two-month-old Ubuntu GNOME setup with a split / and /home partitions. From what I can tell, a few sectors in / were damaged, but that's not an issue. On the other hand, /home's par... |
All right, so for the first question it turns out the debugfs stats command tells what the starting blocks for every section of a group are. In addition, I guessed that inumbers had to be consecutive and increasing, so basic addition of the offset into the inode table and the imap command gave me the first inumbers; i... | Can I find out if a given ext4 block is in the inode table, and if so, can I pick it out of a journal with no header by hand? |
1,397,407,725,000 |
I't trying to move around 4.5 million files (size ranges from 100 - 1000 bytes) from one partition to other. The total size of the folder is ~2.4 GB
First I tried to zip it and move the zipped file to the new location. It is able to paste only ~800k files and shows "out of space" error.
Next I tried the mv command and... |
I have found the reason for the error (found it on a different forum).
The error was due to the hashing algorithm used by ext4 which is enabled by "dir_index" parameter. There were too many hashing collisions for me so I disabled it by the following command:
tune2fs -O "^dir_index" /dev/sdb3
The downside is that my p... | Moving millions of small files results in "out of space" error |
1,397,407,725,000 |
I am trying to format an sdcard following this guide. I am able to successfully create the partition table, but attempting to format the Linux partition with mkfs yields the following output:
mke2fs 1.42.9 (4-Feb-2014)
Discarding device blocks: 4096/1900544
where it appears to hang indefinitely. I have left the p... |
I actually suspect you are being bitten by a much talked ext4 corruption bug in kernel 3 and 4. Have a look at this thread,
http://bugzilla.kernel.org/show_bug.cgi?id=89621
There have been constant reports of corruption bugs with ext4 file systems, with varying setups. Lots of people complaining in forums. The bug se... | Formatting an sdcard with mkfs hangs indefinitely |
1,397,407,725,000 |
As you can read here , ext4 file system has an extent feature that groups blocks into extents. Each of them can have up to 128MiB contiguous space. In e4defrag , there are lines similar to the following:
[325842/327069]/file: 100% extents: 100 -> 10 [ OK ]
The size of the file is around 150MiB. So according to t... |
I think I know how it works.
I connected another disk to my machine because it has a big almost empty partition ~458G . I checked its free space via e2freefrag:
HISTOGRAM OF FREE EXTENT SIZES:
Extent Size Range : Free extents Free Blocks Percent
64M... 128M- : 6 146233 0.12%
128M... 2... | How to change the extent size in the ext4 file system? |
1,397,407,725,000 |
Usually, block device drivers report correct size of the device, and it is possible to actually use all the "available" blocks. So, the filesystem knows how much it can write to such device in prior.But in some special cases, like it is with dm-thin or dm-vdo devices, this statement is false. This kind of block device... |
When the block device overcommits its available data capacity like when using thin provisioning or has other reasons to not be able to accept more writes, like having a snapshot full, it has to send a message to what is writing to it. ENOSPC would make no sense in this context, so the error chosen is usually EIO (Inpu... | How does EXT4 handle sudden lack of space in the underlying storage? |
1,397,407,725,000 |
If I kill a running e4defrag, is there a risk of data loss/corruption? Is there a safe way to interrupt it?
For example: running e4defrag on large partition (such as the root directory) or large file (such as a squashfs system image file) is very slow, so sometimes, stopping/killing e4defrag before it is done is neede... |
I haven't checked the code itself, but since e4defrag is only working on a single file at a time, it definitely can't corrupt the whole filesystem.
In any case, the actual data movement is done in the kernel in the context of a journal transaction, so it should be immune to whatever you do in userspace. It shouldn't ... | How to kill/terminate running e4defrag without damaging my data? |
1,397,407,725,000 |
Ext4 has a maximum filesystem size of 1EB and maximum filesize of 16TB.
However is it possible to make the maximum filesize smaller at filesystem level ? For example I wouldn't like to allow to create files greater than a specified value (e.g. 1MB). How can this be achieved on ext4 ?
If not ext4 then any other modern ... |
ext4 has a max_dir_size_kb mount option to limit the size of directories, but no similar option for regular files.
A process however can be prevented from creating a file bigger than a limit using limits as set by setrlimit() or the ulimit or limit builtin of some shells. Most systems will also let you set those limit... | limit the maximum size of file in ext4 filesystem |
1,397,407,725,000 |
From some foggy memories I thought I would "improve" the default settings when creating a Linux partition and increased the inode size to 1024, and also turned on -O bigalloc ("This ext4 feature enables clustered block allocation").
Now, though, I can't find any concrete benefits to these settings cited on the net,... |
Larger inodes are useful if you have many files with a large amount of metadata. The smallest inode size has room for classical metadata: permissions, timestamps, etc., as well as the address of a few blocks for regular files, or the target of short symbolic links. Larger inodes can store extended attributes such as a... | any large inode size benefits? (ext4) |
1,397,407,725,000 |
I was reading about Linux 5.2 patch note released at last year, I noticed that they started to optional support for case-insensitive names in ext4 file system.
So... what I am wondering is the reason why the case-insensitive option (including casefold and normalization) was needed in the kernel. I could find out anoth... |
case-insensitive file system allows us to resolve important bottlenecks for applications being ported from other operating systems
does not reach my heart and I cannot understand how the process of normalization and casefolding allow us to optimize our disk storage.
Wine, Samba, and Android have to provide case-in... | Why case-insensitive option in ext4 was needed? |
1,433,980,862,000 |
I want to create an ext4 filesystem, and add some files to it, then "freeze" it so it is henceforth read-only.
I know it's possible to use the ro mount option. But is there some way to indicate in the filesystem itself that it is read-only?
I see that tune2fs has an option -o to set default mount options, but -o ro is... |
This is supported in recent kernels (4.0 and later) and, since late February 2015, in e2fsprogs (available since version 1.42.13).
With the appropriate kernel and tools, you can flag an ext4 filesystem read-only using tune2fs:
tune2fs -O read-only ext4test
and clear the flag as always with
tune2fs -O ^read-only ext4t... | Mark an ext4 filesystem as read-only |
1,433,980,862,000 |
System file: ext4
I changed the owner of files to apache: with the command:
chown -R apache: wp.localhost
Then, I could not change the permissions of directories in wp.localhost nor the wp.localhost itself
I use the command chmod +w wp.localhost for example. and I do not see any permission change on it.
I also change... |
If you want to grant global write permission on that directory, you have to do
chmod a+w wp.localhost [1]
This is because omitting the 'who is affected' letter (u, g, o or a) implies a, but won't set bits that are set in your current umask. So, for example, if your umask was 0022, the 'write' bit is set in the 'grou... | chmod does not change permissions of certain directories |
1,433,980,862,000 |
Using ext4 filesystem I was able to read out the creation time of a file using the approach here. As a result I am indeed provided with a table featuring the crtime (creation time) of the inode(respective file) in question.
What confuses me and to which I could not find an answer in the man debugfs is why it shows me ... |
This is the result of an editing error in the e2fsprogs patch debugfs: add support to properly set and display extended timestamps. The second crtime: line ought to be dtime:.
if (inode->i_dtime)
fprintf(out, "%scrtime: 0x%08x:(%08x) -- %s", prefix,
large_inode->i_dtime, large_inode->i_ctime_extra,
... | Why does my file have multiple crtime entries? |
1,433,980,862,000 |
My partition table looks like this:
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 32505855 16251904 83 Linux
/dev/sda2 32505856 33554431 524288 83 Linux
When I went to lay down a filesystem on sda2, it threw this error:
sudo mkfs -t ext4 /dev/sda2
mk... |
1: it doesn't have to do anything with primary/extended/logical partitions.
2: I think you wanted to say "logical" partition instead of "extended".
3: mkfs thinks your partition size if 0 bytes. It was very surely, because the kernel wasn't able to update the partition table after a repartitioning. After you edited th... | "inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks" while creating a file system |
1,433,980,862,000 |
ext4.wiki.kernel.org makes it sound like e2fsck was simply renamed to e4fsck so that e4fsprogs and e2fsprogs could coexist without overlapping. However, there is no mention of any difference in the code of the command.
The e2fsck man page makes no mention of ext4, but does mention that it works with ext3 (i.e. ext2 wi... |
e4fsprogs on RHEL5 is just a newer version of e2fsprogs. Red Hat has a policy of not upgrading to newer, binary-incompatible versions of things, so they "had to" stay on the old e2fsprogs they were using, and the solution they came up with to support ext4 was to introduce the newer version as e4fsprogs (with s/2/4/ o... | Is there any difference between e2fsck and e4fsck on CentOS / RHEL systems? |
1,433,980,862,000 |
I have a raid array, in fact, two raid arrays which are very similar, however one is being written to constantly (by jbd2 it seems) and the other is not. Here are the arrays:
md9 : active raid5 sdl4[4] sdk4[2] sdh4[1] sdb4[0]
11626217472 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
bitmap: 2/29 ... |
Looks like I already found the culprit after typing a full question...
Even though the volume is already over a week old (vs the other array which is two weeks old), another process ext4lazyinit is still busy initializing inodes (which I even limited to a very sane 4 million, instead of the insane 4 gazillion mkfs.ext... | Constant low volume writes to raid array (jbd2), what's causing it? |
1,433,980,862,000 |
I have a folder (watch) that got filled with a lot of temporary files by mistake. I've cleared out all of those files but the the folder is still 356 kB in size. In the past I've moved the folder out of the way, created a new folder with the same name, and copied all the files into it to get it back down to its former... |
e4fsck supports -D flag which seems to do what you want:
try to optimize all directories, either by reindexing them if the filesystem supports directory indexing, or by sorting and compressing directories for smaller directories, or for filesystems using traditional linear directories.
Of course, you'll need to unmo... | How do I reset the folder metadata size without recreating the folder? |
1,433,980,862,000 |
I imagine that adding n xattrs of length l of to f files and d directories may generate costs:
storage
path resolution time / access time ?
iteration over directories? (recursive find over (fresh after reboot not-cached) filesystem?)
I wonder what are those costs?
E.g. if tagging all files would significantly impact... |
For ext4 (I can't speak for BtrFS), storing small xattrs fit directly into the inode, and do not affect path resolution or directory iteration performance.
The amount of space available for "small" xattrs depends on what size the inodes are formatted as. Newer ext4 filesystems use a default inode size of 512 bytes, o... | What are costs of storing xattrs on ext4, btrfs filesystems? |
1,433,980,862,000 |
Suppose I have a sparse file F on a Linux ext4 filesystem, and process P1 is writing to a disjoint 50% subset of F while P2 writes to the other 50% of F. I would like to minimize fragmentation while the file "grows". (I put "grows" in quotes because the file is pre-allocated as a sparse file, but as the blocks get w... |
The kernel caches the writes and lazily flushes them to disk in the background, allocating disk space as it does so in such a way that it minimizes fragmentation. In other words, you're over thinking things -- don't worry about it.
More specifically when it does to to flush some dirty cache buffers, ext4 goes to allo... | Fragmentation and ext4 |
1,433,980,862,000 |
Is the quota approach still in use to limit the usage of disk space and/or the concurrency between users.
Quota works with aquota.user files in the concerned directories AND some settings in /etc/fstab with options like usrquota…
But some times, regarding with journalised filesystems, this options change for usrjquota... |
Is the quota approach still in use?
Yes it is. Since disks have grown in size, quotas might not be of much worth to common users, but still find their usage in multi-user environment e.g. on servers. Android uses quotas on ext4 and f2fs to clear caches and and control per-app disk usage. In-kernel implementations as... | What is the most recent technique to implement quotas? |
1,433,980,862,000 |
I'm assuming that this means that if the average file stored (including directories etc) is less than 16384 bytes, it may be possible to run out of inodes before using the full storage capacity of the filesystem. However, should the files being stored consume over 16384 bytes, on average, a physical space storage limi... |
Yes that is about right. A couple of minor points to note are:
As far as I can see the overhead of the filsystem itself isn't considered when calculating the number of inodes from this ratio, so the actual average size that a file can be will be slightly lower than 16834 when you consider the overhead superblock, ino... | What are the implications of using an inode_ratio of 16384 in terms of storage use on ext4? |
1,433,980,862,000 |
A directory inode isn't substantially different from that of a regular file's inode, what I comprehend from Ext4 Disk Layout is that:
Directory Entries:
Therefore, it is more accurate to say that a directory is a series of data blocks and that each block contains a linear array of directory entries.
The director... |
Directory entries are stored both in inode.i_block and the data blocks. See "Inline Data" and "Inline Directories" in the document you linked to.
| How come that inodes of directories store filenames in ext4 filesystem? |
1,433,980,862,000 |
Since 5.10 kernel there is a new feature called fast_commit. In arch wiki https://wiki.archlinux.org/title/ext4 you can read that it can be enabled in existing filesystem with:
tune2fs -O fast_commit /dev/drivepartition
but in https://lwn.net/Articles/842385/ there is:
Fast commits are activated at filesystem creatio... |
tune2fs -O fast_commit is supported since e2fsprogs 1.46.0, which was released two weeks after the LWN article was published. So the article was correct at the time of publication, and the Arch wiki is correct now.
tune2fs -O fast_commit doesn’t just set the corresponding flag, it creates all the required data structu... | Ext4 fast_commit feature |
1,433,980,862,000 |
First, I have create the directory that I will want to mount to.
mkdir /mnt/ramdisk
Now, I could easily turn this into a ramdisk using ramfs or tmpfs via
mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk
I've found a tutorial on how to create a ramdisk which breaks this syntax down as:
mount -t [TYPE] -o size=[SIZE] [FST... |
I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.
First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.
Next, I cr... | How can I create an ext4 ramdisk? |
1,433,980,862,000 |
I want to grow an ext4 volume on a host, but I noticed that there is no valid partition table to delete and remake:
fdisk -u /dev/vdb
/dev/vdb: device contains a valid 'ext4' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions
Device doe... |
I'm not seeing a partition table to grow in the first place.
Because there isn't one. In general partition table is not needed, you can format a disk to ext4 (or other filesystem) and use it directly without partitions. It's a perfectly valid use case if you want to use the entire disks without partitioning it. Just... | Device does not contain a recognized partition table |
1,433,980,862,000 |
We have Linux Redhat version 7.2 , with xfs file system.
from /etc/fstab
/dev/mapper/vgCLU_HDP-root / xfs defaults 0 0
UUID=7de1ab5c-b605-4b6f-bdf1-f1e8658fb9 /boot xfs defaults 0 0
/dev/mapper/vg
/dev/mapper/vgCLU_HDP-root / xfs ... |
This is addressed in this knowledge base article; the main consideration for you will be the support levels available: Ext4 is supported up to 50TB, XFS up to 500TB. For really big data, you’d probably end up looking at shared storage, which by default means GFS2 on RHEL 7, except that for Hadoop you’d use HDFS or Glu... | big data + what is the right filesystem ext4 or xfs? |
1,433,980,862,000 |
This will still write to /dev/foo if there is a journal:
mount -oro /dev/foo /mnt/disk
How can I treat /dev/foo as read-only?
|
mount -oro,noload /dev/foo /mnt/disk
| Mount ext4 read-only |
1,433,980,862,000 |
I have some files with special characters like accented letters.
They are valid names, but for some reason when they are copied across the network to a drive, maybe in another format, the name still looks the same but it is not the same.
I can copy the file back and now I have two files that appear to have the exact s... |
Pipe the file names to od or a similar tool:
printf '%s\n' * | od -t x1 -a
$ ls
Accentué bar foo
$ printf '%s\n' * | od -t x1 -a
0000000 41 63 63 65 6e 74 75 c3 a9 0a 62 61 72 0a 66 6f
A c c e n t u C ) nl b a r nl f o
0000020 6f 0a
o nl
0000022
Ma... | View file names in hex? |
1,433,980,862,000 |
What is the difference between disabling journal on ext4 file system using:
tune2fs -O ^has_journal /dev/sda1
and using data=writeback when mounting? I thought ext4 - journal = ext2. means when we remove journal from a ext4 file system, it is automatically converted to ext2(thus we can not benefit from other ext4 fea... |
The two are in no way equivalent. Disabling the journal does exactly that: turns journaling off. Setting the journal mode to writeback, on the other hand, turns off certain guarantees about file data while assuring metadata consistency through journaling.
The data=writeback option in man(8) mount says:
Data ordering ... | disabling journal vs data=writeback in ext4 file system |
1,433,980,862,000 |
I saw that kernel 5.2 got handling of ext4 case-insensitivity per directory by flipping a +F bit in inode.
This EXT4 case-insensitive file-name lookup feature works on a
per-directory basis when an empty directory is enabled by flipping the
+F inode attribute.
https://www.phoronix.com/scan.php?page=news_item&px=... |
First you need recent enough software:
Linux kernel >= 5.2 for the kernel-side support in EXT4
userland tools: e2fsprogs >= 1.45 (eg: on Debian 10 which ships only version 1.44 this requires buster-backports). Provides among others mke2fs (alias mkfs.ext4), tune2fs and chattr.
UPDATE:
e2fsprogs >= 1.45.7 needed to a... | How to enable new in kernel 5.2 case-insensitivity for ext4 on a given directory? |
1,433,980,862,000 |
My root-partition is formatted as ext4-filesystem.
I notice that, whenever my machine crashes and I have to hard-reset it, when booting up again and the root filesystem is checked this step takes a bit (like one to two seconds) longer than when booting from a cleanly shut down system, but it is reported as "clean" (an... |
The fsck already takes place within the initrd/ initramfs (after an unclean shutdown it takes several seconds longer with a lot of disk activity at this stage, where the journal seems to be replayed), and thus, when the normal, more verbose, file system checks are beeing run from the main system, it is already clean.
| ext4 reported as clean by fsck after hard reset: Is that normal? |
1,433,980,862,000 |
I would like to reduce the size of an ext4 partition from my disk and I would like to know if it is possible that my files become corrupted during the operation ? I learn that ext4 file system use large extents for each file, so is it possible that a file is located at the end of the partition and become corrupted/del... |
Yes, it is safe
As long as the process is not interrupted by i.e. power loss, your data will be fine. This is what resize2fs is made for. It will move data around so nothing is lost. it will warn you if you attempt something potentially harmful. I used resize2fs numerous times for offline shrinking and never experienc... | Is it safe to resize partition in ext4? |
1,433,980,862,000 |
“Multiply claimed blocks” is an error reported by fsck when blocks appear to belong to more than one file. This causes data corruption since both files change when one of the files are written.
But what can be the original causes of multiply claimed blocks? How are they created and how can I avoid them?
|
As stated very early by Theodore Tso himself, there can be two immediate reasons for “Multiply claimed blocks” to be reported by fsck :
One is that one or more blocks in the inode table get written to the
wrong place, overwriting another block(s) in the inode table.
This is most often triggered by some kernel bug. (... | What can cause “multiply claimed blocks” on an ext4 drive? |
1,433,980,862,000 |
My VirtualBox filesystem looks like:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 29799396 5467616 22795012 20% /
devtmpfs 1929980 0 1929980 0% /dev
tmpfs 1940308 12 1940296 1% /dev/shm
tmpfs 1940308 8712 1931596 1% /run
tmpfs... |
I didn't find the answer on how to use zerofree on such disks but I found an alternative solution which works well.
Mount your disk somewhere (in my case 3 disks are mounted to locations: /srv/node/d1, /srv/node/d2, /srv/node/d3).
Enter the directory where your disk is mounted (cd /srv/node/d1).
Perform the command: ... | How to use zerofree on a whole disk? |
1,433,980,862,000 |
I have replaced my hard drive with an SSD and have installed Fedora on it exactly the same as my HDD. I'm attempting to read the data from the hard drive, but since both of the LVM partitions have partitions named fedora-home I can't mount it and it causes this error:
mount: /media: wrong fs type, bad option, bad supe... |
LVM requires each VG / LV to have its own unique name. It will refuse to activate duplicate names. If these are coming from separate installs, they'll each have their own unique VG UUID as shown in vgdisplay output.
Using this UUID you can rename one of them...
vgrename $VGUUID homburg
...and that should resolve the ... | How to mount lvm partitions with duplicate names |
1,433,980,862,000 |
summary
Suppose one is setting up an external drive to be a "write-once archive": one intends to reformat it, copy some files that will (hopefully) never be updated, then set it aside until I need to read something (which could be a long while or never) from the archive from another linux box. I also want to be able t... |
I don't agree with the squashfs recommendations. You don't usually write a squashfs to a raw block device; think of it as an easily-readable tar archive. That means you would still need an underlaying filesystem.
ext2 has several severe limitations that limit its usefulness today; I would therefore recommend ext4. Sin... | "write-once archive": ext2 vs ext4^has_journal vs |
1,433,980,862,000 |
I'm trying to play around with OS development, and I started with a boot loader, where phase 0 loads phase 1 from a file (specified by inode) on an ext4 partition (specified by first LBA). Of course, I need something to boot from, so I grabbed QEMU. Now what?
What has worked fine so far is this:
truncate -s64M /tmp/So... |
The long way around. But for the fun of it:
1. Create a temporary image:
$ truncate -s64MiB tmp.img
2. Create two partitions using fdisk:
Rather detailed, but OK.
$ fdisk tmp.img
First partition:
: n <Enter>
: <Enter> (p)
: <Enter> (1)
: <Enter> (2048)
: +40M <Enter>
Second partition:
: n <Enter>
: <Enter> (p)
... | How can I partition a volume in a regular file without loop? |
1,433,980,862,000 |
I'm trying to keep a bunch of plain text files compressed using the extended attribute option - c on a debian ppc64 system. I ran the following commands:
# mkfs.ext4 /dev/test/compressed
# mount /dev/test/compressed /mnt/compressed/
# mkdir /mnt/compressed/some/txts/
# chattr +c /mnt/compressed/some/txts/
# df -l
# c... |
Makes sense to have a look at the man page of the programs you use:
BUGS AND LIMITATIONS
The c', 's', andu' attributes are not honored by the ext2 and ext3 filesystems as implemented in the current mainline Linux kernels.
This is not supposed to mean "ext4 works" I guess.
| What does the command "chattr +c /some/dir/" do? |
1,433,980,862,000 |
I need to identify the last sector used by an ext4 filesystem so that I can move it to another device.
The filesystem has been shrunk (with resize2fs) and is smaller than the partition that contains it, so I am not asking how to find the last sector in the partition.
I have done tune2fs -l and identified that
Block co... |
You are right. There shouldn't be any problem.
To avoid some calculations you could use the bs option and use the partition name of the device rather than starting at an offset.
dd count=48934 bs=4096 if=/dev/sdxN of=...
To be 100% sure about the size you could test it before. "Simulate" a smaller partition:
umount... | How can I find the last sector used by an ext4 filesystem? |
1,433,980,862,000 |
I ran tune2fs -l /dev/sda on my production server today and got the following output:
tune2fs 1.42.9 (4-Feb-2014)
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: a5b1c696-aa59-43db-a252-88b2e6d8212c
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem... |
An orphaned inode is one that has been unlinked but is still open in another process. For example running tail -f {file} in one shell followed by rm {file} in another. The filesystem keeps track of these so they can be cleaned up when the process quits.
See this note on Ext4 Disk Layout.
| "First orphan inode" in tune2fs output |
1,433,980,862,000 |
I want to encrypt the content of a directory in a container with an ext4 filesystem using cryptsetup. The size of the container should be as small as possible and as big as necessary, because I only want to write once and then backup.
First try: setting the size of the container to the size of the content.
dirsize=$(d... |
LUKS by default uses 2 MiB for its header, mainly due to data alignment reasons. You can check this with cryptsetup luksDump (Payload offset: in sectors). If you don't care about alignment, you can use the --align-payload=1 option.
As for ext4, it's complicated. Its overhead depends on the filesystem size, inode size,... | How much storage overhead comes along with cryptsetup and ext4? |
1,433,980,862,000 |
I fear I may have to revert to system defaults if I can't get this sorted out.
I'm trying to set various system configurations for more robust ext4 for a single-user desktop environment. Trying to assign desired configuration settings where they will take effect properly.
I understand that some of these should be incl... |
Given the discussion that has transpired as comments on my original post, I am prepared to conclude that the many changes to the Kernel over the 2+ years since my original install of the UbuntuMATE 20.04 LTS distro are the source of the differences in behaviour observed by the set of 8 ext4 filesystems that were creat... | OS seems to apply ext4 filesystem options in arbitrary fashion |
1,433,980,862,000 |
Disk/Partition Backup
What are the backup options and good practice to make a solid and easy to use full system backup?
With the following requirement:
Live backup
Image backup
Encrypted backup
Incremental backups
Mount/access the backup disk/files easily
Full system backup, restorable in one shot
Can be scheduled au... |
Linux system backup
When targeting a true full system backup, disk image backup (as asked) offer substantial advantage (detailed bellow) compared to files based backup.
With files based backup disk/partition structure is not saved; Most of the time for a full restore, the process is a huge time consumer in fact many ... | Serious backup options for linux disk (dmcrypt, luks, ext4, ext3, btrfs) normal and encrypted system |
1,433,980,862,000 |
Instead of configuring my Nextcloud (Linux/Nginx/PGsql/PHP) server to look for a folder on my spinning hard drive mounted at /mnt/HDDfs/, I Sym-Linked /var/Nextcloud_Data so it points to /mnt/HDDfs/Nextcloud_Data and then pointed my Nextcloud config to /var/Nextcloud_Data. This way, if I ever decide to change the name... |
It's fine, for many reasons.
First, the concern with flash drives is the number of writes, not the number of reads.
Second, this concern applies to older or cheaper drives with poor firmware or poor drivers, but not to modern drives on modern operating systems. Modern SSD have good enough wear leveling and modern OSes... | Am I hammering my SSD by keeping a symlink on it? |
1,433,980,862,000 |
When I was installing Mint Debian edition unlike the classic edition, the installation automatically formated my home partition when I did not specify to format.
So the formatting previously was ext4 as is now. I believe the data is still there as it was a quick format.
I have now booted the computer up on a live USB... |
Take a look at the e2fsprogs package. It seems that you can get all your backup superblocks from dumpe2fs /dev/sd<partition-id> | grep -i superblock and then have e2fsck check the FS for you, or just try to do mount -o sb=<output-of-dumpe2fs> /dev/sd<partition-id> /your/mountpoint with a backup superblock. See this fo... | Data recovery from an accidental format on ext4 partition |
1,507,018,455,000 |
Environment:
- Virtual machine on VMWare ESX 4.0
- OS: fully up to date RHEL 5.8
After adding a new (virtual) disk I want to create an ext4 partition on LVM on this disk.
Steps taken so far:
$ sudo /sbin/fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DO... |
It's bad error checking in the argument parsing I think causing that message. The version of mke2fs on RHEL 5 doesn't support the -t type argument, so it's somehow parsing the /dev/VGora/oradata path as the last (optional) block count argument.
Anyway, the way you'll want to do it is to ensure you have e4fsprogs inst... | Creating an ext4 partition fails with "invalid blocks count" |
1,507,018,455,000 |
I have a 2TB Western Digital external hard disk.
Its original filesystem was NTFS, but I formatted it to EXT4.
I had no problem in Linux; but today after I mounted it using ext2fsd in a Windows box, I can't mount it in Linux anymore!
The drive had no partition, but after that Windows mount, Disk utility shows it has a... |
It is quite unusual to format a filesystem on a hard disk without a partition table. It appears that you did in fact, have a partition table before, and the partition started at sector 2048, which is the usual starting location for the first partition on a disk these days. If you run fdisk and use the u command to c... | Can't mount EXT4 hard drive after mounting it in Windows |
1,507,018,455,000 |
I'm about to setup my new USB key with Grub or Grub2. In the old days I used ext2 for the boot partition.
I'm wondering if I could use ext4 for Grub2?
And if use Grub 0.9X, what about support of ext3?
|
Grub legacy (0.9x) supports ext2 and ext3 (ext3 is backward compatible with ext2) but not ext4 (unless you've turned off the backward-incompatible features, which doesn't leave much additional goodness compared with ext3). The development of Grub legacy stopped before ext4 was mature. There are unofficial patches to s... | Ext4 support in Grub 0.9X (legacy) and Grub 1.9X (Grub2) |
1,507,018,455,000 |
I am writing 4 * 4KB blocks to a file. It is consistently around 50% slower if I have used fallocate() to pre-allocate the file with 9 blocks, instead of only pre-allocating the 4 blocks. Why?
There seems to be a cut-off point between pre-allocating 8 and 9 blocks. I'm also wondering why the 1st and 2nd block writes... |
The reason for the difference between 8 and 9 4KB blocks is because ext4 has a heuristic when converting an unallocated extent created by fallocate() to an allocated extent. For unallocated extents 32KB or less, it just fills the whole extent with zeroes and rewrites the whole thing, while larger extents are split int... | Why is it slower to write the same data to a *larger* pre-allocated file? |
1,507,018,455,000 |
We have beaglebone black based custom board with 256MB RAM and 4GB eMMC.
Board runs Linux kernel 4.9
we are running into a situation where we create a file in tempfs and then after validation, we have to move it to the ext4 partition of eMMC. File nothing but a certificate
in some situations, we have multiple certs in... |
Is moving file from tmpfs to ext4 atomic?
No. Renames as such only work within a filesystem. The manual page for rename(2) explicitly mentions the error that is returned if trying to rename across mount points:
EXDEV oldpath and newpath are not on the same mounted filesystem.
Moves across file systems need to be d... | is there a way to atomically move file and directory from tempfs to ext4 partition on eMMC |
1,507,018,455,000 |
On my linux system if I display the current date "t1", touch a file "f" then display the modification time "t2" of that "f" I would expect t1 < t2.
But that's not what I always get when I execute this on my system:
date +'%Y-%m-%d %H:%M:%S.%N'; \
touch f; \
stat -c %y f
Example output:
2017-09-18 21:47:48.855229801
2... |
Per https://stackoverflow.com/questions/14392975/timestamp-accuracy-on-ext4-sub-millsecond :
ext4 filesystem code calls current_fs_time() which is the current cached kernel time truncated to the time granularity specified in the file system's superblock which for ext4 is 1ns.
The current time within the Linux kernel... | linux: touch date precision |
1,507,018,455,000 |
After a crash, I've got an Ext4 filesystem (on an LVM LV) that gives the following error when running fsck.ext4 -nf:
e2fsck 1.42.12 (29-Aug-2014)
Corruption found in superblock. (blocks_count = 0).
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it... |
Your device has exactly 4294967296 blocks, which is 232, so this smells like a variable-size problem... If you’re running a 32-bit e2fsck, that could explain the error message; the error you’re seeing comes from e2fsck/super.c:
check_super_value(ctx, "blocks_count", ext2fs_blocks_count(sb),
MIN_CHECK... | ext4 corruption found in superblock, but filesystem can be mounted |
1,507,018,455,000 |
so that it appears in Thunar's sidebar under the name 'Schijf-2'?
I am running linux mint13 xfce and this has been a headache causer for the last couple of days.
the UUID of this partition is:
this is the output from blkid:
/dev/sda2: UUID="913aedd1-9c06-46fa-a26e-32bf5ef0a150" TYPE="ext4"
How should I enter this in f... |
By default, if your fstab entry is:
UUID=913aedd1... /media/Schijf-2 ext4 rw,relatime 0 2
your partition will not be shown as Schijf-2 in your sidebar, unless it is labelled Schijf-2. You have two options:
Leave the fstab entry as is and label your partition (e.g. if sda2 is your partition):
e2label /de... | how should I mount my ext4 partition in fstab |
1,507,018,455,000 |
This is mostly theorethical question without real practical usage.
As you may know, filenames are stored in directory inode. That means the more files we have and the longer filenames are the more space directory uses.
Unfortunately if files were deleted from the directory the space which is used by directory is not f... |
You can optimize the directory using fsck.ext4 -D on an unmounted filesystem:
-D Optimize directories in filesystem. This option causes e2fsck
to try to optimize all directories, either by reindexing them if
the filesystem supports directory indexing, or by sorting and
compr... | How to update directory size after file removal? |
1,507,018,455,000 |
Where does ext4 store directory sizes? Are they stored in the directory inode?
For example, when I run du -h, it returns directories' size instantly, so I don't believe it calculates it at that time.
I'm using ext4 on Linux.
|
Using strace would seem to indicate that the file sizes are indeed calculated by querying the files within the directory.
Example
Say I fill a directory with 3 1MB files.
$ mkdir adir
$ fallocate -l 1M adir/afile1.txt
$ fallocate -l 1M adir/afile2.txt
$ fallocate -l 1M adir/afile3.txt
Now when we trace the du -h comm... | Where does ext4 store directory sizes? |
1,507,018,455,000 |
I see this in my dmesg log
EXT4-fs (md1): re-mounted. Opts: commit=0
EXT4-fs (md2): re-mounted. Opts: commit=0
EXT4-fs (md3): re-mounted. Opts: commit=0
I think that means that dealloc is disabled? does mdadm not support dealloc?
|
mdadm supports dealloc.
commit=sec is the time, the filesystem syncs its data and metadata. Setting this to 0 has the same effect as using the default value 5.
So I don't get the link between mdadm and commit=0 in your question?
| what is commit=0 for ext4? does mdadm not support it? |
1,507,018,455,000 |
I have an SSD with 2 partitions formatted with ext4. On the second partition, I enabled discard as a default option at the filesystem level with this command:
$ sudo tune2fs -o discard /dev/sda2
tune2fs 1.45.5 (07-Jan-2020)
$ sudo tune2fs -l /dev/sda2 | grep 'mount options'
Default mount options: user_xattr acl dis... |
/proc/mounts and mount don’t show settings which are included in the default settings, including defaults set in the file system options using tune2fs, so unfortunately this is normal.
To determine whether discard is enabled, you need to check the defaults, check the mount options, and combine the two sets of informat... | Is it normal for tune2fs default mount options to not appear in mount output? |
1,507,018,455,000 |
If I create a small filesystem, and grow it when I need to, will the number of inodes increase proportionally?
I want to use Docker with the overlay storage driver. This can be very inode hungry because it uses hardlinks to merge lower layers. (The original aufs driver effectively stacked union mounts, which didn't ... |
Yes. See man mkfs.ext4:
-i bytes-per-inode
Specify the bytes/inode ratio. mke2fs creates an inode for
every bytes-per-inode bytes of space on the disk. The larger
the bytes-per-inode ratio, the fewer inodes will be created.
This value generally shouldn't ... | If I grow an ext4 partition, will it increase the number of inodes available? |
1,507,018,455,000 |
I bought a new 2.5-inch external hard drive of 5TB in size from Seagate.
On my Linux Mint 21.1 now, I need to format the newly created partition with gdisk:
Model: Expansion HDD
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 52CB8F84-EFAF-4EC9-B65D-6F8541A65F53
Partition table holds up to 12... |
Defaults change over time, and might also depend on your distro.
You can check it yourself with tune2fs -l. Format in different ways and compare tune2fs output.
For testing only, you can also create sparse files of identical size. This avoids having to format your existing filesystems for testing.
The size should be s... | Checksumming on Ext4 (crc32c-intel) while formatting (5TB external HDD) |
1,507,018,455,000 |
I am on a test VM where I am trying to convert a second disk to btrfs.
The conversion fails with the error missing data block for bytenr 1048576 (see below).
I couldn't find any information about the error. What can I do to fix this?
$ fsck -f /dev/sdb1
fsck from util-linux 2.35.2
e2fsck 1.45.6 (20-Mar-2020)
Pass 1: C... |
It was a bug
Now we have pinned down the bug, it's a bit overflow for multiplying
unsigned int.
Also see:
https://github.com/kdave/btrfs-progs/commit/c9c4eb1f3fd343512d50b075b40bba656cbd02cb
https://www.spinics.net/lists/linux-btrfs/msg103379.html
As a workaround you can resize your filesystem to something smaller... | "missing data block" when converting ext4 to btrfs |
1,507,018,455,000 |
Today I went through my desktop stations running Linux Mint 17.3 Cinnamon and did a file system check of root partitions with Ext4 file systems as follows:
# fsck.ext4 -fn /dev/sdb2
The problem is that on all of the computers I see something similar to this one:
e2fsck 1.42.9 (4-Feb-2014)
Warning! /dev/sdb2 is moun... |
First off, fsck'ing a mounted filesystem is expected to produce errors. The filesystem isn't consistent because the journal hasn't been replayed (nor has it been cleanly unmounted), and you can't replay the journal because that (like any other change) would corrupt the filesystem. If you're using LVM, you could take a... | How to fsck root file system before boot or on reboot [duplicate] |
1,507,018,455,000 |
I know there is option "--bind" for multiple mount operation to handle such case. But ext4 can be directly mounted at different mount points, without option "--bind". So, I wonder whether it is safe to mount ext4 filesystem at different mount points. And I find that ext4 support a feature "mmp"(multiple mount prote... |
Yes, it's perfectly safe. It's mentioned in the manpage for mount().
Since Linux 2.4 a single filesystem can be visible at multiple mount
points, and multiple mounts can be stacked on the same mount point.
I think mmp is something else. Something about mounting a block device which is shared between mul... | Is it safe to mount same ext4 filesystem at different mount points? |
1,507,018,455,000 |
Is there a way to set atime writes to be cached for a very long time? I need atime (that is to say, relatime won't cut it), but I don't want it to effect performance so much. Data loss in of atimes (and atimes only) is acceptable in some cases (e.g. power failure).
|
I found lazytime, a mount option for ext4, that solves this satisfactorily for me.
https://lwn.net/Articles/620086/
This mode causes atime, mtime, and ctime updates to only be made to the in-memory version of the inode. The on-disk times will only get updated when (a) when the inode table block for the inode needs t... | Cache atime writes |
1,507,018,455,000 |
The default reserved blocks percentage for ext filesystems is 5%. On a 4TB data drive this is 200GB which seems excessive to me.
Obviously this can be adjusted with tune2fs:
tune2fs -m <reserved percentage> <device>
however the man page for tune2fs states that one of the reasons for these reserved blocks is to avoi... |
The biggest problem with fragmentation is free space fragmentation, which means that when your filesystem gets full and there are no longer big chunks of free space left, your filesystem performance falls off a cliff. Each new file can allocate only small chunks of space at a time, so is very fragmented. Even when o... | Recommended maximum percentage to fill a large ext4 data drive |
1,507,018,455,000 |
I am adding a second drive to my Ubuntu Server. It was previously in a FreeNas system, but I got rid of the XFS partition and created an ext4 partition (in an older Ubuntu system). I then backed up all my data onto it, then installed the disk in my Ubuntu Server.
dmesg | tail
[ 294.570830] EXT4-fs (sdb): VFS: Can't f... |
It looks like you have an EFI GPT partition table there. You'll need support for that in your kernel. As a quick-check, do zgrep CONFIG_EFI_PARTITION /proc/config.gz. Here is a HOWTO on mounting partitions of such a disk.
| Unable to mount a second hard drive in Ubuntu Server |
1,507,018,455,000 |
I have been having several issues with a CentOS 9 VM related to file permissions. I've never had this much trouble before, and I'm wondering if it has something to do with the security options and file systems I selected during install (GUI STIG and ext4).
Example issue 1:
Two python files in the same directory, with... |
After scouring the internet, I have an answer. Of course the answer was on Stack Overflow/Stack Exchange already (here), but it took me days to track it down.
My VM was running fapolicyd as part of the STIG compliance configuration I enabled at installation. This daemon inserts itself via hooks in the file permissio... | File permissions not matching allowed operations...? |
1,507,018,455,000 |
ext4 is failed me again! the most unstable fs
tried to fix it by restoring block from backup, but without luck..
↪ sudo fsck.ext4 -v /dev/sdd
e2fsck 1.45.6 (20-Mar-2020)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while... |
since you have worked partition somewhere in backup inside hdd
↪ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The primary GPT table is corrupt, but the backup appears OK, so that will be used.
... | ext4 - Bad magic number in super-block |
1,507,018,455,000 |
I was brushing up and diving deeper into filesystem anatomy and in numerous resources it is said to be a requirement that the very first superblock start at an offset of 1024 bytes. I started looking for any sort of documentation as to why 1024 was chosen, it just seemed pretty arbitrary. All I could find was the foll... |
The master boot record (MBR) at the beginning of a disk contains only 446 bytes of code, so it is tiny and cannot do much. Therefore, a common booting technique is to do what is called "chain loading," where the MBR loads code at the beginning of the active partition and jumps to that code. By leaving the first two ... | EXT filesystem family: Why does the first superblock start at offset 1024? |
1,507,018,455,000 |
Let's suppose I create a file, map it to /dev/loop0, and create a LUKS partition inside
dd if=/dev/zero of=myfile bs=1M count=1000
losetup /dev/loop0 myfile
cryptsetup -c aes-cbc-essiv:sha256 -s 256 -v -y luksFormat /dev/loop0
I then open the encrypted partition
cryptsetup luksOpen /dev/loop0 myfile
Now, I have my ... |
From my experience running an encrypted reiserfs with private information you should not put that on an journalling filesystem like ext3. I switched back from ext3 to having the file on an ext2 partition after I had to restore from a backup.
Over the years ( I have had this file for 5 years ), I had to run recovery se... | File containing ext filesystem |
1,507,018,455,000 |
Some preamble: I'm taking bitwise copy of disk devices (via dd command) from twin hosts (i.e. with the same virtualized hardware layout and software packages, but with different history of usage). To optimize image size I trailed all empty space on partitions with zeroes (e.g. from /dev/zero). I'm also aware of reser... |
You can purge the journal by either un-mounting, or remounting read-only (arguably a good idea when cloning). With ext4 you can also turn off the journal altogether (tune2fs -O ^has_journal), the .journal magic immutable file will be removed automatically. The journal data will still be on the underlying disk of cours... | How to clean journals in ext3/ext4 filesystem? [closed] |
1,507,018,455,000 |
My setup is the following:
Linux kernel 2.6.28
e2fsprogs 1.42.7
64 GB class 10 SD card
I am attempting to speed up the time it takes to format the entire card to an ext4 filesystem. My research has pointed me towards the lazy_itable_init=1 option for mkfs.ext4. If I understand correctly, these options will improv... |
The reason the inode tables are initialized with zeros it to make sure that any garbage that happened to be there before does not get misinterpreted as a valid inode by e2fsck. Normally it won't make any difference but if e2fsck detects errors, it may try to recover by heuristically recognizing inodes whether or not ... | Risks involved with lazy_itable_init=1 for ext4 fs on SD card |
1,445,260,167,000 |
I'm trying to understand how inode numbers (as displayed by ls -i) work with ext4 partitions.
I'm trying to understand whether they are a construct of the linux kernel and mapped to inodes on disk, or if they actually are the same numbers stored on disk.
Questions:
Do inode numbers change when a computer is reboote... |
I'm trying to understand how inode numbers (as displayed by ls -i) work with ext4 partitions.
Essentially, inode is a reference for a filesystem(!), a bridge between actual data on disk (the bits and bytes) and name associated with that data (/etc/passwd for instance). Filenames are organized into directories, where... | How do inode numbers from ls -i relate to inodes on disk |
1,445,260,167,000 |
I'm working with Tensorflow's TFRecords format, which serializes a bunch of data points into a single big file. Typical values here would be 10KB per data point, 10,000 data points per big file, and a big file around 100MB. TFRecords are typically written just once - they are not appended. I think this means they will... |
Maybe, if the file is not fragmented on the disk. But it probably doesn't matter if it's strictly constant time.
ext2 and ext3 stored the locations of the data blocks in trees that had 1 to 4 levels, so lookups couldn't be constant-time. Also, the blocks of the tree could in principle be anywhere along the filesystem,... | Do files in an ext4 filesystem allow constant time seeking? |
1,445,260,167,000 |
I have the following devices with Linux Mint 18.1 on laptops and GNU/Linux Debian 9 on the server.
(All are 64-bit and with Cinnamon desktop.)
All drive devices are formatted with ext4 filesystem; RAID 1 is done utilizing mdadm.
Laptop with 1 SSHD (not to be confused with HDD).
Laptop with 3 drives: 2 x consumer HDDs... |
e4defrag needs the file system to be mounted because it asks the kernel’s file system driver to perform the defragmentation, it doesn’t do it itself.
As for free space defragmentation and relevant file defragmentation, the patches were never completed; the last mention on the relevant mailing list dates back to 2014:
... | Defragmentation options on Ext4 filesystem |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.