date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,428,267,066,000
I need to compile a C++ application to run on Red Hat 5.9, but I don't have access to a development server that runs Red Hat 5.9. My current executable compiled on Ubuntu 10.04 produces the error message /lib/libc.so.6: versionGLIBC_2.11' not found` which probably means that RedHat is using an older libc. Which fre...
CentOS 5.9 is binary compatible with RHEL 5.9. You can even fire it up in a VM.
Compiling for Red Hat 5.9
1,428,267,066,000
I have a script (say Task.sh) (with executable permission): Pseducode: if [[ Not called from inside a script ]]; then echo 'Not called from inside a script' else echo 'Called from a script' fi I have a script say Main.sh (with executable permission): Value=$(Task.sh) echo "${Value}" Expected Outcome $ Task.sh ...
One option is to change the requirements slightly from "am I running in a script?" to "am I connected to a terminal or a pipe/file?". This would allow for the case of Task.sh >/tmp/file: it's not called from a script, but it seems it should write to the file rather than the clipboard. If that's acceptable then you can...
Change behavior of bash script if executed from another script
1,428,267,066,000
Can process execute new program without the kernel knowing? Usually, when the program is executing kernel gives to it its own process after receiving the syscall (such as exec() or fork()). In this case, everything goes through the kernel, which finally starts the program with, for example, ELF handler. In practice, o...
Yes, this is possible. The already-running process needs to load (or map) the new program at the appropriate locations in the process’ virtual address space, load the dynamic loader if necessary, set up the required data structures on the stack, and jump to the new program’s entry point in memory. (Many of these opera...
Can process execute new program without the kernel knowing?
1,428,267,066,000
Are there any Unix/Linux filesystems that do the following? if the file is executable, return a virtual file containing the stdout generated by executing it (it would have to be non-writable, I suppose); otherwise behave the same as ext4 and friends and provide the file itself. I recently had a situation where I cou...
Ok, let's see if I got this right: You have some data in LDAP, that refers to some filename (among other things). Presumably that file is on some network share readable by all the hosts using that LDAP directory, and you'd like the contents of the file to be created dynamically. So, e.g. the directory contains credent...
Do 'executable' file systems exist?
1,428,267,066,000
The context I've downloaded scilab-6.1.0.bin.linux-x86_64.tar.gz from the official website of "Scilab" because I want to be able to use the provided tools. Within the bin directory of the downloaded files, I've the following files $ ls -l | cut -d ' ' -f 5- 1713591 Feb 25 05:27 modelicac 2057719 Feb 25 05:27 modelica...
Running a symlink which points to an executable does indeed run the executable, but there is one important difference: the first argument given to the new process, which (in this case) stores the command given, gives the name of the symlink, not the name of the target executable. This allows programs to implement diff...
Executing a symbolic link yields different results than executing the file to which it points
1,428,267,066,000
This is on Arch Linux. Take a look at this: [saint-llama@hubs bin]$ lsattr --------------e----- ./install_fnp.sh --------------e----- ./toolkitinstall.sh --------------e----- ./FNPLicensingService [saint-llama@hubs bin]$ file FNPLicensingService FNPLicensingService: ELF 64-bit LSB executable, x86-64, version 1 (SYSV...
This command fixed it for me on Arch Linux allowing me to run the elf binary: sudo pacman -Syy ld-lsb lsb-release For other flavors of linux, You should either install the ld-lsb package (or lsb-compat or any similar package which contains ld-lsb-x86-64.so.3) or create a wrapper / executable script that starts your p...
File definitely exists. Get "No such file or directory" when trying to run it
1,428,267,066,000
I know that a root user can read a file even if the access permissions are all set to 0 but i don't understand about the write and execute permissions in specific. Can a superuser write and execute a file having permissions as 000 ?
It can write the same as it can read. Being root trumps these. But with execution it's a different story. If a file is not marked as executable, then it's not considered executable. However, once it's marked executable, it doesn't have to be readable for root to be executed (if it is a script). Unlike it is with the r...
Can superuser write a file having 000 access permissions?
1,428,267,066,000
I can't understand what's going on. Yesterday everything was working normally. Literally all I did since then was clearing the bash history with history -cw. Today all I get when trying to execute my g++-compiled programs is complete void: The same code works perfectly fine when compiled on another machine. I can't ...
Wrong direction on your slash. Use / instead: [rinkaru@localhost ~]$ ./6.out
What could have caused g++ (and clang++) executables to stop working? [closed]
1,428,267,066,000
I thought my compliation was okay because no errors were printed out, yet when I try to run the executable, he tells me that it's unreachable... coppan12@b048-08:~$ gcc -Wall prog.c -o prog coppan12@b048-08:~$ prog La commande « prog » est introuvable any hint?
Try ./prog to run prog in the current working directory, as . is typically not (nor should be) in PATH. Also, a Makefile is perhaps much more sensible, as then you can simply type make test and have the program built (if necessary) and tested: prog: prog.c test: prog echo blah de blah | ./prog A Makefile ca...
Is my compilation false?
1,428,267,066,000
I am using the command -v "program" >/dev/null 2>&1 construct if I need to POSIX-ly find out if such program is installed in an if-statement. From its help page is not clear, whether it checks only for path or also for the executable bit? $ command --help command: command [-pVv] command [arg ...] ... -v prin...
command -v uses the PATH to find the executable. It also checks the permission. If you try command -v a_non_executable_file, nothing will be printed. You can try strace bash -c 'command -v grep' you will see that the access(2) system call is executed (this system call check the user's permissions for a file). command ...
Is `command -v program` always executable?
1,428,267,066,000
Background Using xfce4-terminal as an example, I want to run the program by just typing term. When I type which xfce4-terminal it returns /usr/bin/xfce4-terminal. So, I created a symbolic link: sudo ln -s /usr/bin/xfce4-terminal /usr/bin/term. Now I can execute the program by typing term. Question I've been wondering ...
The safest way is to use an alias, as they has already mentioned in the comments. Symlinking will work as well, but be aware that some programs change their behaviour depending on the name by which they were called. E.g. bash-scripts checking the content of $0 and calling different functions depending on it. Renaming ...
Reasonable way to customize ( change ) an executable program's command ( name ) , in terminal
1,428,267,066,000
I'm using Linux debian 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-1kali1 (2017-06-06) x86_64 GNU/Linux and want to make /home/pantheon/Desktop/pycrust-20170611-2151.sh run in terminal when I klick on it. The file is written in python, #!/bin/env python import os os.system("cd /home/pantheon/Desktop/fluxion") os.system("...
You need to use #!/usr/bin/env python as your shebang (note the /usr).
Run a file automatically in terminal when you click on it
1,428,267,066,000
I have a folder on my HDD /media/kalenpw/HDD/Documents/ShellScripts that is full of various scripts I would like to have accessible from any directory. My previous strategy was copying all of the files into /usr/local/bin this worked, but was tedious when updating scripts having to change in two places. Luckily, I rec...
1) The proper way to access lots of scripts is to just add the directory the scripts are in to your $PATH. For example, I have my personal scripts in ~/bin, so in my .profile, I have a line export PATH=$HOME/bin:$PATH That puts my ~/bin in front of the existings paths, so I'm able to "overwrite" other programs by hav...
Execute symlink on different physical drives
1,428,267,066,000
They should both get the files that are executable but I get different numbers [user@j6727961 ~]$ sudo find /usr -perm /a=x | nl 1 /usr 2 /usr/bin 3 /usr/bin/nroff 4 /usr/bin/gzexe 5 /usr/bin/catchsegv 6 /usr/bin/diff 7 /usr/bin/gzip 8 /usr/bin/gencat 9 /usr/bin/d...
According to man find: -perm /mode Any of the permission bits mode are set for the file. So -perm /a+x will match a file with any executable bit set. -executable Matches files which are executable and directories which are searchable (in a file name resolution sense). This t...
What's the difference between sudo find /usr -perm /a=x and sudo find /usr -executable
1,428,267,066,000
I am issuing the following rsync command (obfuscating the exact path & host), which should copy two binaries: rsync -e "ssh -p 443" -a --info=progress2 -z user@remote:/srv/cgi-bin/ . user@remotes's password: 5,970,149 100% 6.78MB/s 0:00:00 (xfr#2, to-chk=0/3) From every standpoint I can tell, the command co...
You are trying to run a 32-bit executable in a 64 bit system. Do do so you have to install the 32 bit libraries, in short, you have to make your system multilib. or try to recompile by sending the sources as well through rsync.
Executable file isn't "really there" after rsync [duplicate]
1,428,267,066,000
I am in my home directory. And there is an executable a.out in there. I want to execute it like- /bin/csh ~/a.out ^F^E@@@@@▒^A▒^A^H^C^D^B^B@^B@^\^\^A^A^E@@: Event not found. Its not that I cannot simply run ./a.out that works perfectly fine. But I want to know why it is not working the other way round? Also, /bin/cs...
/bin/csh filename tells the shell to read shell commands from filename. If you want the shell to execute the file (which is not the same thing), you should use /bin/csh -c ./a.out.
Error while executing a.out from C shell
1,428,267,066,000
I don't know if I'm permitted to ask about zPanel here, but I'll go ahead and try and hope for the best. Stackexchange has helped me a lot in different areas... I was following the instructions to install zPanel on my freshly installed CentOS 6.4 x64 VPS, but I'm facing this error which wont let me finish step 5 from ...
You're trying to run x86-64 software on a i686 platform. This will not work. Get the i686 version instead.
ELF interpreter error - Can't install on my CentOS
1,428,267,066,000
I have found a few old posts claiming that tmpfs can execute in place. Is this true? If so, how? If not, is there a ram drive alternative? Can this be done with a ram drive that is encrypted? If so, how?
You're going to need some very specialized hardware to do what you're trying to do. Here are the constraints: The program must be in RAM, because that's where the CPU can find it. It doesn't matter how it got there. The program must not be in RAM unencrypted. I don't know where you want to store the encryption key....
Execute in Place an encrypted ram drive
1,428,267,066,000
I am trying to write a script python script that is supposed to run across all linux based OSes. The python script invokes executables of few existing tools(for example pathload and iperf) that I have compiled and included with the script. For this purpose, I need to compile the executables to be run across all linux...
Also, is there any better way of achieving this task? Yes, at least two ways come to my mind: You can distribute source code. "Unix" has a long tradition of "portability" through source code. Note that both iperf and pathload are distribuited by sources and both use autoconf to "grant" portability (and it is not acc...
How many types of architectures and OSes
1,428,267,066,000
I installed a tool called herd (http://diy.inria.fr/herd/). The original version of this I think is in the global path so I can call it from anywhere by writing herd7. Now I also have a second installation which I compiled myself. It is in a different directory. I don't know how to call that second one specifically. I...
It's a matter of convention. I'll use the gcc compiler as an example to explain things. Typing which gcc in Redhat 8 results in /usr/bin/gcc. Doing gcc --version results in version 4.8.5 which is the default installed version. If I want to download and install a later version of gcc such as version 11.4, I tell it i...
How to disambiguate a second version of an installation from command-line?
1,428,267,066,000
I am observing the following behaviour, and want to know if it is expected. I am trying to run disk usage ( du ) as user2 on a directory test_directory which is owned by user1. If I change the permissions to allow everyone full access (using chmod 777 test_directory), then both user1 and user2 are able to properly se...
Without the execute/access (x) permission on dir, you can't call stat() on dir/foo.bin, and can't see how large it is. Having just the read (r) permission lets you only list the filenames, but the names are all you get in general. In some systems, readdir() might give more information than just the names, but I'm not ...
Does a user need executable permissions to be able to run du (disk usage)? [duplicate]
1,428,267,066,000
I have an executable file file that I am running by typing ./file into the terminal. When the program runs, I have to type in the text "code". However, the time taken to type it, or paste it into the terminal, results in the program saying "sorry, you took too long!". I am tying to send the text "code" to the executab...
You may want to use the pipeline feature https://en.wikipedia.org/wiki/Pipeline_(Unix) : echo "code" | ./file
Enter text into executable file immediately after it's run
1,428,267,066,000
I have 136 .vcf files in a folder; I want to extract some information from each of them and write the output in a .txt file like below [fi1d18@cyan01 snp]$ bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%ID]\n' file.vcf > file.txt I am doing that one by one manually but takes an ages; Can somebody please helps me in ...
Go to the folder with your files, and loop over these files. Use "$f" for input and "${f%.*}.txt" as output file name ${f%.*} will strip the extension from the filename (via). for f in *.vcf; do bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%ID]\n' "$f" > "${f%.*}.txt" done
How I can these .vcf files to txt at the same time
1,428,267,066,000
I have an executable on my usb drive. I cd to the directory, ./app yields permission denied. So I did chmod u+x app. Then, ./app. But still, permission denied.! Then I read something here: That command [chmod] only changes the permissions associated with the file; it does not change the security controls associated ...
The command to remount the drive with execute allowed goes like sudo mount $THING -o remount,exec but with an apropriate value for $THING. You can use the device name, or the mount point.
Running an executable off of a usb drive
1,428,267,066,000
I encountered that the command bsdtar from the package libarchive (under Arch Linux, at least) does throw away executable bits of files in .zip-archives when reading from stdin, but not when directly working on the file. On .tar-archives it preserves the executable bit also when reading from stdin. Test case: Create t...
Here on the bugtracker of libarchive is the answer: Zip archives contains two different ways to describe the content: A per-entry header A central directory at the end of the zip file. libarchive (and bsdtar by extension) will use the central directory if seeking is possible on the input, otherwise it will fall bac...
Why does libarchive's bsdtar's unzip throw away the permission bits when reading a ZIP-archive from stdin, but not directly?
1,428,267,066,000
I have a console program: #include <iostream> #include <stdio.h> using namespace std; int main() { printf("please num1:"); int a; cin>>a; printf("please num2:"); int b; cin>>b; cout<<"see the result"<<endl; return a+b; } With the executable named test. When I put this line:/path/to/test test & inside the home/user/....
since your program is a console program and not a graphical one, as you stated and as your code shows you need to launch it in a console, in a terminal. e.g. gnome-terminal -- test.sh in this case, I used gnome-terminal and the executable was test.sh. this is the command to launch at startup
How to start a console program at startup(inside ../openbox/autostart)
1,428,267,066,000
When I compile a C program with gcc I get the file a.exe; however, to run this I have to type in the command ./a.exe. I believe it is possible to edit the .bashrc or .bash_profile so that I only need to write the command a.exe?
Files ending in .exe are common on windows systems. On linux systems binaries usually do not have any extension. When running gcc with out using -o to specify the name of the output file it will (for historical reasons) usually create a file named a.out. When trying to run a command without specifying its location lin...
Running a program that's been compiled with gcc
1,428,267,066,000
Today I copied some files from the shared folder (Host is a Win7) to my VM ( Guest is a CentOS7). I did this with root permissions. Then I copied th files to my apache location /var/www/html/test I am using putty, I only see the files in green and with the following permissions. -rwxr-x--- 1 root root 175417 Mar 15...
Being executable is a type of mode. chmod changes modes. chown changes owners (ie. the user that owns this file, which has the mode bits with the highest magnitude). As such all you need to do is chmod a-x <path> to remove the executable bit for all ("a") users. If you just wanted to do it for your user, the owner ("o...
executable files to normal files via terminal CentOS7
1,415,129,156,000
I executed the minimal building directions of xcape: $ sudo apt-get install git gcc make pkg-config libx11-dev libxtst-dev libxi-dev $ mkdir xcape $ cd xcape $ git clone https://github.com/alols/xcape.git . $ make But when I press xcape it says xcape: command not found. It errors even when I'm in the xcape folder wi...
Have you tried ./xcape ? You have to execute it this way, because the location is probably not defined in the $PATH variable.
Installing Xcape (question involving the "make" command)
1,415,129,156,000
I'm not sure what to try next to resolve this issue. ~ üåù cat /etc/fstab # /dev/sdg1 /mnt/d/ ntfs noatime,nodiratime,users,noauto,x-systemd.automount,autodefrag 0 0 /dev/md127 /mnt/d btrfs nofail,compress=zstd:1,noatime,nodiratime,users 0 0 The disk mount location /mnt/d was previousl...
It's because of this: Partition mounted noexec even though not specified in /etc/fstab I should've looked at the output of the command mount instead of fstab
Unable to exec programs, parent directory symbolic link, btrfs mdadm drive
1,415,129,156,000
I have a ksh script I am developing for work. (I am on the newer side to shell-scripting) I have root access but the future-users of this script will not. Say the other user is named User1. Within the script are commands to other executables in the system. These executables throw "permission denied" for User1 when Use...
I figured out a work around. The commands that User1 cannot access are scripts themselves. So I am manually implementing the logic from those scripts into my script. This allows allow User1 to do the desired behavior of the commands without actually calling the commands. Thank you all for your time.
Allow user to run nonpermissive commands in shell script (KSH)
1,415,129,156,000
I am trying to make an executable script on Mac where it makes the directory it is housed in the current directory (cd) and then runs some more commands. I started with a find command however in the end that ended up causing issues because of similarly named files. Thanks in advance! I don't know what code to run howe...
You can extract the path to the directory containing the script from the name of the script. The name of the script is stored in $0 variable. You can use dirname to extract path from it. So, to change the current working directory to the location of the script when it is run, you could start it like this: #!/bin/zsh c...
Unix Executable to the directory it is housed in Mac
1,415,129,156,000
Taking a random word as input from the user, can anyone suggest a logic in shell scripting to check if any permutation of that word is actually an executable command or not?
Try pipelining with compgen command
Check if a user given random word is an executable linux command or not?
1,415,129,156,000
After compiling software from source code, I can usually launch the compiled binary by double-clicking on it. Recently however, most of my compiled binaries are not responding to double-click, even if they can be launched using ./MyBinary. This doesn't seem to be a permission problem because I have already done sudo c...
ELF portable executables and libraries may have the same signatures and be identified identically. I wouldn't fret about that. If Dolphin works for you, use it. E.g. $ file `which file` /usr/lib64/libc-2.31.so /bin/file: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpre...
Executable binaries labelled as shared library files
1,415,129,156,000
My goal is to manage the startup of a number of applications with an application executed by a user with elevated permissions. The plan is to have the startup manager (a node.js script using require('child_process').exec) cd to the home dir of the app user & su <app user> and then execute the startup as <app user>. My...
Once started as <app user>, your running application will only have the permissions that user has. As for being able to exit, once your application has terminated, there isn't going to be anything to issue the exit. I don't know what your script does, but generally speaking, the startup of applications is better manag...
Are there drawbacks (security or otherwise) to using 'su <user>' into a lesser-priveleged user to start a web application?
1,415,129,156,000
I am writing a small program to us in LuaLaTex. The purpose of it is to produce an qr-code with a given uuid, the qr-code is printed on the page and the uuid is stored in the pdf's meta-data. Nevertheless I thought it would be nice to have a single executable in the texmf folder to called by the class file from my do...
Yes. The qrencode program is just a wrapper around libqrencode, and the convert command is just a wrapper around ImageMagick. Instead of calling those commands, call the library functions from your code directly. Bindings such as https://github.com/isage/lua-imagick and https://github.com/vincascm/qrencode will be use...
Lua standalone with external binary program
1,415,129,156,000
I have a crontab with different time to execute some task, for example every minute, every 10 min, 1 hour, daily... And i have a question, when some of this cron coincide in the same time for example, when 10 minutes execute, also execute 1 min cron and this cron execute in parallel... but I want to execute in sequen...
With cron itself, I don't think you really can. I would probably script my way out of that: make a single script executed from cron every minute, and then run the tasks with separate intervals from that script. Something like this: Crontab entry: * * * * * /path/to/main_script.sh And main_script.sh: #!/bin/sh mins=$[...
Crontab order run with differents schedule
1,415,129,156,000
I believe I've corrupted the /usr/bin/time executable as when I try to run it, this is the message that shows up: bash: /usr/bin/time: cannot execute binary file It was working till I inadvertently overwrote it. How can I revert the changes I've made to this executable or get a fresh copy of it? Thanks in advance.
To reinstall the time binary /usr/bin/time, reinstall the package that contains it. First, find that package. dpkg -S /usr/bin/time time: /usr/bin/time Then install it. sudo apt-get install --reinstall time
/usr/bin/time cannot execute binary file
1,357,727,051,000
I was just reading up on the Birth section of stat and it appears ext4 should support it, but even a file I just created leaves it empty. ~ % touch test slave-iv ~ % stat test.pl slave-iv File: ‘test.pl’ ...
The field gets populated (see below) only coreutils stat does not display it. Apparently they're waiting1 for the xstat() interface. coreutils patches - aug. 2012 - TODO stat(1) and ls(1) support for birth time. Dependent on xstat() being provided by the kernel You can get the creation time via debugfs: debugfs -R...
Birth is empty on ext4
1,357,727,051,000
I am not talking about recovering deleted files, but overwritten files. Namely by the following methods: # move mv new_file old_file # copy cp new_file old_file # edit vi existing_file > D > i new_content > :x Is it possible to retrieve anything if any of the above three actions is performed assuming no special pro...
The answer is "Probably yes, but it depends on the filesystem type, and timing." None of those three examples will overwrite the physical data blocks of old_file or existing_file, except by chance. mv new_file old_file. This will unlink old_file. If there are additional hard links to old_file, the blocks will remain ...
Can overwritten files be recovered?
1,357,727,051,000
Is there a simple option on extundelete how I can try to undelete a file called /var/tmp/test.iso that I just deleted? (it is not so important that I would start to remount the drive read-only or such things. I can also just re-download that file again) I am looking for a simple command with that I could try if I mana...
Looking at the usage guide on extundelete it seems as though you're limited to undeleting files to a few ways. Restoring all extundelete is designed to undelete files from an unmounted partition to a separate (mounted) partition. extundelete will restore any files it finds to a subdirectory of the current directory n...
undelete a just deleted file on ext4 with extundelete
1,357,727,051,000
Recently, my external hard drive enclosure failed (the hard drive itself powers up in another enclosure). However, as a result, it appears its EXT4 file system is corrupt. The drive has a single partition and uses a GPT partition table (with the label ears). fdisk -l /dev/sdb shows: Device Boot Start E...
Unfortunately, I was unable to recover the file system and had to resort to lower-level data recovery techniques (nicely summarised in Ubuntu's Data Recovery wiki entry), of which Sleuth Kit proved most useful. Marking as answered for cleanliness' sake.
Recovering ext4 superblocks
1,357,727,051,000
I have an external hard drive which is encrypted via LUKS. It contains an ext4 fs. I just got an error from rsync for a file which is located on this drive: rsync: readlink_stat("/home/some/dir/items.json") failed: Structure needs cleaning (117) If I try to delete the file I get the same error: rm /home/some/dir/item...
That is strongly indicative of file-system corruption. You should unmount, make a sector-level backup of your disk, and then run e2fsck to see what is up. If there is major corruption, you may later be happy that you did a sector-level backup before letting e2fsck tamper with the data.
Cannot remove file: "Structure needs cleaning"
1,357,727,051,000
What happens if the limit of 4 billion files was exceeded in an ext4 partition, with a transfer of 5 billion files for example?
Presumably, you'll be seeing some flavor of "No space left on device" error: # truncate -s 100M foobar.img # mkfs.ext4 foobar.img Creating filesystem with 102400 1k blocks and 25688 inodes ---> number of inodes determined at mkfs time ^^^^^ # mount -o loop foobar.img loop/ # touch loop/{1..25688} touch: cannot touch '...
What happens if the limit of 4 billion files was exceeded in an ext4 partition?
1,357,727,051,000
The default journal mode for Ext4 is data=ordered, which, per the documentation, means that "All data are forced directly out to the main file system prior to its metadata being committed to the journal." However, there is also the data=journal option, which means that "All data are committed into the journal p...
Yes, data=journal is the safest way of writing data to disk. Since all data and metadata are written to the journal before being written to disk, you can always replay interrupted I/O jobs in the case of a crash. It also disables the delayed allocation feature, which may lead to data loss. The 3 modes are presented in...
Is data=journal safer for Ext4 as opposed to data=ordered?
1,357,727,051,000
I'm running Arch Linux, and use ext4 filesystems. When I run ls in a directory that is actually small now, but used to be huge - it hangs for a while. But the next time I run it, it's almost instantaneous. I tried doing: strace ls but I honestly don't know how to debug the output. I can post it if necessary, though i...
A directory that used to be huge may still have a lot of blocks allocated for directory entries (= names and inode numbers of files and sub-directories in that directory), although almost all of them are now marked as deleted. When a new directory is created, only a minimum number of spaces are allocated for directory...
Why does "ls" take extremely long in a small directory that used to be big? How to fix this?
1,357,727,051,000
I have a very high density virtualized environment with containers, so I'm trying to make each container really small. "Really small" means 87 MB on base Ubuntu 14.04 (Trusty Tahr) without breaking up the package manager compatibility. So I use LVM as a backing storage for my containers and recently I found very stran...
Try this: mkfs.ext4 -N 104 -m0 -O ^has_journal,^resize_inode /dev/purgatory/test1 I thinks this does let you understand "what is going on". -N 104 (set the number of iNodes you filesystem should have) every iNode "costs" usable space (128 Byte) -m 0 (no reserved blocks) -O ^has_journal,^resize_inode (deactivate th...
Why doesn't my exactly 100 MiB partition at 1 KiB block size have the corresponding available blocks/space?
1,357,727,051,000
I have a Debian system here. fsck runs from time to time while booting (on an ext4 file system). I get messages like this: inode extent tree (at level 1) could be shorter IGNORED What do they mean?
They mean that e2fsck determined that an extent tree (a data structure used to point to data in the file system) could be restructured to have less depth (presumably because it tracked extents in the past which are no longer in use, so the tree could be rebalanced). That’s not much of a problem in practice, unless the...
"inode extent tree (at level 1) could be shorter IGNORED"
1,357,727,051,000
I can successfully mount an ext4 partition, the problem is that all the files on the partition are owned by the user with userid 1000. On one machine, my userid is 1000, but on another it's 1010. My username is the same on both machines, but I realise that the filesystem stores userids, not usernames. I could correct ...
Take a look at the bindfs package. bindfs is a FUSE filesystem that allows for various manipulations of file permissions, file ownership etc. on top of existing file systems. You are looking specifically for the --map option of bindfs: --map=user1/user2:@group1/@group2:..., -o map=... Given a mapping user1/user2, ...
How can I mount a filesystem, mapping userids?
1,357,727,051,000
I want to format my USB stick to ext4 and just use as I would any other typical non-linux format drive (FAT32, exFAT, NTFS). That is to say, I want to be able to plug the usb stick into any of my linux machines, and read/write to it without needing to adjust permissions, like doing chmod or chown stuff. I would prefe...
Like any unix-style filesystem, ext4 includes standard Unix file ownership and permission conventions. That is, the user is identified by an UID number, and each user will belong to one or more groups, each group identified by its GID number. Each file has an owner UID and one group owner GID. The three classic Unix f...
How to make an ext4 formatted usb drive with full RW permissions for any linux machine?
1,357,727,051,000
In the ext4 wiki article I've seen that ext4 can be used up to 1 EiB, but is only recommended up to 16 TiB. Why is that the case? Why is XFS recommended for larger file systems? (ELICS: Explain me like I'm a CS student, but without much knowledge in file systems)
The exact quote from the ext4 Wikipedia entry is However, Red Hat recommends using XFS instead of ext4 for volumes larger than 100 TB. The ext4 howto mentions that The code to create file systems bigger than 16 TiB is, at the time of writing this article, not in any stable release of e2fsprogs. It will be in future...
Why is ext4 only recommended up to 16 TB?
1,357,727,051,000
I want to shrink an ext4 filesystem to make room for a new partition and came across the resize2fs program. The command looks like this: resize2fs -p /dev/mapper/ExistingExt4 $size How should I determine $size if I want to substract exactly 15 GiB from the current ext4 filesystem? Can I use the output of df somehow?
You should not use df because it shows the size as reported by the filesystem (in this case, ext4). Use the dumpe2fs -h /dev/mapper/ExistingExt4 command to find out the real size of the partition. The -h option makes dumpe2fs show super block info without a lot other unnecessary details. From the output, you need the ...
How do I determine the new size for resize2fs?
1,357,727,051,000
We have seen OS doing Copy on Write optimisation when forking a process. Reason being that most of the time fork is preceded by exec, so we don't want to incur the cost of page allocations and copying the data from the caller address space unnecessarily. So does this also happen when doing CP on a linux with ext4 or x...
The keyword to search is reflink. It was recently implemented in XFS. EDIT: the XFS implementation was initially marked EXPERIMENTAL. This warning was removed in the kernel release 4.16, a number of months after I wrote the above :-).
Does any file system implement Copy on Write mechanism for CP?
1,357,727,051,000
I'm migrating a server from an Ubuntu Server 18.02 instance ("saturn") to a newly-built Debian Buster 10 system ("enceladus"). I have copied a complete filesystem across the network using sudo rsync --progress -au --delete --rsync-path="sudo rsync" /u/ henry@enceladus:/u I check the number of directories and the num...
I can think of two things offhand: you didn't use -H, so hardlinks are lost. you didn't use -S, so sparse files may have been expanded
Filesystem copied to new server is 60% bigger - why
1,357,727,051,000
Playing with e2fsprogs debugfs, by change/accident, a file named filen/ame was created. Obviously the forward slash character / serves as the special separator character in pathnames. Still using debugfs I wanted to remove the file named filen/ame, but I had little success, since the / character is not interpreted as ...
If you want a fix and are not just trying out debugfs, you can have fsck do the work for you. Mark the filesystem as dirty and run fsck -y to get the filename changed: $ debugfs -w -R "dirty" /tmp/ext4fs $ fsck -y /tmp/ext4fs ... /tmp/ext4fs was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, an...
How to delete a file named "filen/ame" (with slash) on an ext4 filesystem in debugfs?
1,357,727,051,000
I have a micro SD card which has a FAT32 partition and an EXT4 partition. The EXT4 partition will no longer mount. dmesg shows the following error: EXT4-fs (sdb2): bad geometry: block count 2199023779840 exceeds size of device (524288 blocks) I've Googled, but still don't fully understand where the problem is (in the...
Since I wasn't able to find any other solution, I reformatted the EXT4 partition. This eliminated the bad geometry error. Wish I knew why.
Fix EXT4-fs bad geometry (block count exceeds size of device)
1,357,727,051,000
I'm wondering what the output of lsattr means.It prints so oddly as follows,when I have tried: lsattr /usr. $ lsattr /usr -----------------e- /usr/local -----------------e- /usr/src -----------------e- /usr/games --------------I--e- /usr/include --------------I--e- /usr/share --------------I--e- /usr/lib -------------...
The man page for chattr contains all the info you need to understand the lsattr output. excerpt The letters 'aAcCdDeFijmPsStTux' select the new attributes for the files: append only (a), no atime updates (A), compressed (c), no copy on write (C), no dump (d), synchronous directory updates (D), extent format (e), case...
What's the meaning of output of lsattr
1,357,727,051,000
I am in progress of resizing a LUKS encrypted partition that contains a single ext4 filesystem (no LVM or something). The cryptsetup FAQ recommends to remove the old partition and recreate it, but that sounds like wasting a lot time. Therefore I want to proceeed by manually, carefully resizing the partition. So far, I...
After backing up (step 1) and unmounting (between 2 and 3), run fsck to ensure that the filesystem is healthy: e2fsck -f /dev/mapper/ExistingExt4 Other than that, the steps are OK. Purpose of the cryptsetup resize command what should I choose for $SECTORS? Is this step even necessary? This step is necessary, otherw...
How can I shrink a LUKS partition, what does `cryptsetup resize` do?
1,357,727,051,000
What are the consequences for a ext4 filesystem when I terminate a copying cp command by typing Ctrl + C while it is running? Does the filesystem get corrupted? Is the partition's space occupied by the incomplete copied file still usable after deleting it? And, most importantly, is terminating a cp process a safe thin...
This is safe to do, but naturally you may not have finished the copy. When the cp command is run, it makes syscalls that instruct the kernel to make copies of the file. A syscall, or system call, is a function that an application can use to requests a service from the kernel, such as reading or writing data to the dis...
What happens when I kill 'cp'? Is it safe and does it have any consequences?
1,357,727,051,000
For a presentation, I need to show ext4 File System is better than NTFS. I searched and got nice article on both ext4 and NTFS http://en.wikipedia.org/wiki/Ext4 http://en.wikipedia.org/wiki/NTFS But I need a comparison guideline with better example.
"Better" is subjective and not very meaningful. Nevertheless, you can get a good comparison of filesystems (including NTFS and ext4) on Wikipedia. There's also an article on PC World that covers it more briefly. Ultimately you should remember that performance metrics in this case are not really a good measure of files...
Why ext4 File System is better than NTFS? [closed]
1,357,727,051,000
Ubuntu 14.04 on a desktop Source Drive: /dev/sda1: 5TB ext4 single drive volume Target Volume: /dev/mapper/archive-lvarchive: raid6 (mdadm) 18TB volume with lvm partition and ext4 There are roughly 15 million files to move, and some may be duplicates (I do not want to overwrite duplicates). Command used (from ...
Bug in the implementation of ext4 feature dir_index which you are using on your destination filesystem. Solution : recreate filesytem without dir_index. Or disable feature using tune2fs (some caution required, see related link Novell SuSE 10/11: Disable H-Tree Indexing on an ext3 Filesystem which although relates to ...
How to fix intermittant "No space left on device" errors during mv when device has plenty of space?
1,357,727,051,000
btrfs (often pronounced "better fs") has quite a few features that ext4 lacks. However, comparing the functionality of btrfs vs ext4, what is lacking in btrfs?1 In other words, what can I do with ext4 that I can't with btrfs? 1 Ignoring the lesser battle-ground testing of btrfs given ext4 is so widely used
Disadvantages of btrfs compared to ext4: btrfs doesn't support badblocks This means that if you've run out of spare non-addressable sectors that the HDD firmware keeps to cover for a limited number of failures, there is no way to mark blocks bad and avoid them at the filesystem level. Swap files are only supported v...
What ext4 functionality does btrfs not support?
1,357,727,051,000
We would like to store millions of text files in a Linux filesystem, with the purpose of being able to zip up and serve an arbitrary collection as a service. We've tried other solutions, like a key/value database, but our requirements for concurrency and parallelism make using the native filesystem the best choice. T...
The ls command, or even TAB-completion or wildcard expansion by the shell, will normally present their results in alphanumeric order. This requires reading the entire directory listing and sorting it. With ten million files in a single directory, this sorting operation will take a non-negligible amount of time. If you...
Millions of (small) text files in a folder
1,357,727,051,000
Yesterday, one of our computers dropped to grub shell or honestly, I am unsure what shell it was when we turned on the machine. It showed that it can't mount the root filesystem or something in this sense, because of inconsistencies. I ran, I believe: fsck -fy /dev/sda2 Rebooted and the problem was gone. Here comes t...
ext4 filesystem check during boot Tested on OS: Linux Mint 18.x in a Virtual Machine Basic information /etc/fstab has the fsck order as the last (6th) column, for instance: <file system> <mount point> <type> <options> <dump> <fsck> UUID=2fbcf5e7-1234-abcd-88e8-a72d15580c99 / ext4 errors=remount-ro 0 1 ...
What should I do to force the root filesystem check (and optionally a fix) at boot?
1,357,727,051,000
Possible Duplicate: ext4: How to account for the filesystem space? I have a ~2TB ext4 USB external disk which is about half full: $ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdc 1922860848 927384456 897800668 51% /media/big I'm wondering why the total size (192286084...
Theres no missing space. 5% reserved is rounded down to the nearest significant figure. 1k Blocks: 1922860848 Reserved 1k Blocks: (24418931 * 4) = 97675724 Total blocks used: 927384456 + 897800668 + 97675724 = 1922860848 Edit: Regarding your comment on the difference between df blocks and 'Block Count' blocks. So the ...
Why is (free_space + used_space) != total_size in df? [duplicate]
1,357,727,051,000
I have a 900GB ext4 partition on a (magnetic) hard drive that has no defects and no bad sectors. The partition is completely empty except for an empty lost+found directory. The partition was formatted using default parameters except that I set the number of reserved filesystem blocks to 1%. I downloaded the ~900MB fil...
3 or 4 fragments in a 900mb file is very good. Fragmentation becomes a problem when a file of that size has more like 100+ fragments. It isn't uncommon for fat or ntfs to fragment such a file into several hundred pieces. You generally won't see better than that at least on older ext4 filesystems because the maximum ...
Why are these files in an ext4 volume fragmented?
1,357,727,051,000
I was reading a blog post about filesystem repair and the author posted a good question… fsck -p is supposed to fix minor errors automatically without human intervention. But what exactly will it fix when it's told to preen the filesystem? What errors will it fix, and what will cause it to stop and tell the user he or...
The answer to your question lies in the e2fsck/problems.c file of the e2fsprogs source code. Looking for the PR_PREEN_OK flag should get you started. As the complete error handling is a bit more involved, due to the multitude of different error conditions that may occur, you are advised to have a closer look at the co...
What does fsck -p (preen) do on ext4?
1,357,727,051,000
There is already the Nimbus ExaDrive 100TB SSD and the 200TB SSD will come soon. As you can read here ext4 supports up to 256 TB. It's only a matter of time hardware will reach this limit. Will they update ext4 or will there be ext5? What will happen?
64-bit ext4 file systems can be up to 64ZiB in size with 4KiB blocks, and up to 1YiB in size with 64KiB blocks, no need for an ext5 to handle large volumes. 1 YiB, one yobibyte, is 10248 bytes. There are practical limits around 1 PiB and 1 EiB, but that’s still (slightly) larger than current SSDs, and the limits shoul...
When is ext5 coming or when will ext4 be updated to support large (huge) SSDs?
1,357,727,051,000
I've recently formatted a 1.5 TB drive with the intention of replacing ntfs with ext4. Then I noticed that the files I saved don't fit on the new partition. df: ext4 (ext3 & ext2 show the same behavior) Filesystem 1K-blocks Used Available Use% Mounted on /dev/sdb1 1442146364 71160 1442075204 1% /med...
Let's see. The device size is 1,465,138,583½ kB = 1,500,301,909,504 B. The filesystem consists of 366,284,288 blocks of 4096 B each, which is 1,500,300,443,648 B. I don't know what the remaining 1,465,856 B (1.4 MB) are used for (additional copies of the superblock? I know there are a few kB of space at the beginning ...
ext4: How to account for the filesystem space?
1,357,727,051,000
I know that mounting the same disk with an ext4 filesystem from two different servers (it's an iSCSI vloume) will likely corrupt data on the disk. My question is will it make any difference if one of the servers mounts the disk read-only while the other mounts it read-write? I know OCFS2 or the likes could be used for...
No. It won't give consistent results on the read-only client, because of caching. It's definitely not designed for it. You could expect to see IO errors returned to applications. There's probably still some number of oversights in the code, that could cause a kernel crash or corrupt memory used by any process. But...
Can the same ext4 disk be mounted from two hosts, one readonly?
1,357,727,051,000
When running e2fsck -cck /dev/mapper/xxx I am prompted with has 487 multiply-claimed block(s), shared with 84 file(s): ... (inode #221446306, mod time Tue Feb 20 19:48:38 2018) ... (inode #221446305, mod time Tue Feb 20 19:48:32 2018) ... (inode #221446304, mod time Tue Feb 20 19:48:38 2018) ... (inode #2214...
Multiply-claimed blocks are blocks which are used by multiple files, when they shouldn’t be. One consequence of that is that changes to one of those files, in one of the affected blocks, will also appear as changes to the files which share the blocks, which isn’t what you want. (Hard links are a different scenario, wh...
Should I answer yes to "Clone multiply-claimed blocks<y>?" when running e2fsck?
1,357,727,051,000
I've just read this question: What does size of a directory mean in output of 'ls -l' command? ...which doesn't quite answer my question. Basically, I'm moving files onto a NAS. The folders I've already moved are completely empty, with no hidden files or anything, and yet du still reports their size at 3.5MB. Admitted...
When you delete all the files from a directory, for most file systems, the directory remains the same size. If the directory is empty, rmdir ./directory_name; mkdir ./directory The resulting new directory will be smaller. But as files are added it will grow larger. Do not worry about directory file size as much a...
Why is this empty directory 3.5MB?
1,357,727,051,000
I'm attempting to run fsck -p /dev/sda5 to repair errors on an ext4 partition, however the command outputs fsck from util-linux-ng 2.17.2 fsck.ext4: Device or resource busy while trying to open /dev/sda5 Filesystem mounted or opened exclusively by another program? I have confirmed using /etc/mtab and lsof that nothin...
There are things (usually in the kernel, like the NFS threads, swap files, bind mounts, etc.) that can keep a filesystem busy that won't show up in fuser. If you try to fsck a filesystem that is mounted, it will get corrupted. You should find a live CD that doesn't automatically mount your filesystems, like Knoppix o...
How can I fsck a partition when the device reads as busy (but has been confirmed otherwise)?
1,643,300,188,000
I have a filesystem with many small files that I erase regularly (the files are a cache that can easily be regenerated). It's much faster to simply create a new filesystem rather than run rm -rf or rsync to delete all the files (i.e. Efficiently delete large directory containing thousands of files). The only issue wit...
Since you're using ext4 you could format the filesystem and the set the UUID to a known value afterwards. man tune2fs writes, -U UUID Set the universally unique identifier (UUID) of the filesystem to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this c1b9d5a2-f162-11cf-9ece-002...
Reset ext4 filesystem without changing the filesystem UUID
1,643,300,188,000
The question is why exactly does a directory shrink after directory entries are removed? Is it due to how ext4 filesystem configured to retain directory metadata? Obviously removing the directory and recreating it isn't a solution, since it deletes original inode and creates a new one. What can be done to decrease the...
Quoting a developer (in a linux kernel thread ext3/ext4 directories don't shrink after deleting lots of files): On Thu, May 14, 2009 at 08:45:38PM -0400, Timo Sirainen wrote: > > I was rather thinking something that I could run while the system was > fully operational. Otherwise just moving the files to a temp direc...
Why directory with large amounts of entries does not shrink in size after entries are removed?
1,643,300,188,000
Related to this. I'd like to take advantage of an OS switch to upgrade to BTRFS. BTRFS claims to offer a lot (data-loss resiliency, self-healing if RAID, checksumming of metadata and data, compression, snapshots). But it's slow when used with fsync-intensive programs such as dpkg (I know eatmydata and the crappy apt-...
I agree with vonbrand, btrfs is not yet to the maturity level of ext* or XFS or JFS to name a few. I would not use it on a laptop with precious data unless I have a reliable backup that can be done also on the go. Btrfs can detect corruptions but it won't do anything more than reporting the detection unless you have a...
Should a laptop user switch from ext4 to btrfs?
1,643,300,188,000
The problem of using a filesystem like ext4 on a USB stick or memory card is that when it's mounted into another system the disk's UID/GID might not be present. Can this be fixed with a mount option?
I assume you're hoping to find an equivalent of the uid=N and gid=N options supported by some of the other filesystems Linux's mount command knows about. Sorry, but no, ext4 doesn't have that option. These other filesystems have such an option in order to give permissions to files for a filesystem that may not have us...
Different UID/GID when using an ext4 formatted USB drive with another computer
1,643,300,188,000
I'm looking for the commands that will tell me the allocation quantum on drives formatted with ext4 vs btrfs. Background: I am using a backup system that allows users to restore individual files. This system just uses rsync and has no server-side software, backups are not compressed. The result is that I have some 3.6...
You'll want to look at the data block allocation size, which is the minimum block that any file can allocate. Large files consist of multiple blocks. And there's always some "waste" at the end of large files (or all small files) where the final block isn't filled entirely, and therefore unused. As far as I know, every...
How do I determine the block size for ext4 and btrfs filesystems?
1,643,300,188,000
If I read the ext4 documentation correctly, starting from Linux 3.8 it should be possible to store data directly in the inode in the case of a very small file. I was expecting such a file to have a size of 0 blocks, but it is not the case. # creating a small file printf "abcde" > small_file # checking size of file in...
To enable inline data in ext4, you'll need to use e2fsprogs 1.43 or later. Support for inline data was added in March 2014 to the Git repository but was only released in May 2016. Once you have that, you can run mke2fs -O inline_data on an appropriate device to create a new filesystem with inline data support; this wi...
How to use the new ext4 inline data feature? (storing data directly in the inode)
1,643,300,188,000
I have a failing hard drive that is unable to write or read the first sectors of the disk. It just gives I/O errors and that is all there is. There are other areas on the disk that seem (mostly) fine. I am trying to mount a partition (ext4) and see if I can access some files I would like to recover. Since the mount co...
There isn't a standard offset per-se, as of course you can start the partition wherever you want. But let's assume for a moment that you're looking for the first partition, and it was created more or less accepting defaults. There are then two places you may find it, assuming you were using a traditional DOS partition...
How do I find the offset of an ext4 filesystem?
1,643,300,188,000
I have just installed Debian 8.4 (Jessie, MATE desktop). For some reason the following command is not recognized: mkfs.ext4 -L hdd_misha /dev/sdb1 The error I get: bash: mkfs.ext4: command not found I have googled and I actually can't seen to find Debian-specific instructions on how to create an ext4 filesystem. Any...
Do you have /sbin in your path? Most likely you are trying to run mkfs.ext4 as a normal user. Unless you've added it yourself (e.g. in ~/.bashrc or /etc/profile etc), root has /sbin and /usr/sbin in $PATH, but normal users don't by default. Try running it from a root shell (e.g. after sudo -i) or as: sudo mkfs.ext4 -...
mkfs.ext4 command not found in Debian (Jessie)
1,643,300,188,000
The manual page says about the barrier option for ext4: Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. If your disks are battery-backed in one way or another, disabling barriers may safely improve performance. Does a lapt...
No, it doesn't. The issue isn't with the type of disk (spinning/non-spinning), it's with committing disk buffers from RAM to disk. If the power goes out suddenly, some of these buffers may never get committed to disk, and having barriers enabled improves your chances of recovering the filesystem. There's also an addit...
Is disabling barriers for ext4 safe on a laptop with battery?
1,643,300,188,000
I have an SSD disk with an ext4 filesystem on it: $ lsblk -f /dev/sdc NAME FSTYPE LABEL UUID MOUNTPOINT sdc ext4 142b28fd-c886-4182-892d-67fdc34b522a I am attempting to mount it, but it is failing: $ sudo mkdir /mnt/data $ sudo mount /dev/sdc /mnt/data mount: /mnt/data: cann...
I had a similar problem with a USB thumb drive which was down to the ext4 journal recovery not working. dmesg confirmed this: [1455125.992721] EXT4-fs (sdh1): INFO: recovery required on readonly filesystem [1455125.992725] EXT4-fs (sdh1): write access unavailable, cannot proceed (try mounting with noload) As it sugge...
mount ext4 disk: cannot mount /dev/sdc read-only
1,643,300,188,000
I know that this feature dates back 20 years but I still would like to find out What is the purpose of the reserved blocks in ext2/3/4 filesystems?
The man page of tune2fs gives you an explanation: Reserving some number of filesystem blocks for use by privileged processes is done to avoid filesystem fragmentation, and to allow system daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the fi...
ext2/3/4 reserved blocks percentage purpose [duplicate]
1,643,300,188,000
Possible Duplicate: How can I increase the number of inodes in an ext4 filesystem? I have a homemade NAS with Debian Wheezy 64bit. It has three disks - 2x2TB and 1.5TB, pooled together using RAID1/5 and LVM. The result is a LVM Logical Volume, about 3.16TB in size, formatted as ext4 and mounted as /home. However I...
From the mke2fs man page: Be warned that it is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter. So the answer is no. What you could do is shrink the existing ext4 volume (this requires unmounting the filesystem), use the fre...
Is it possible to change Inode count on an ext4 filesystem? [duplicate]
1,643,300,188,000
On my personal home computer running Kubuntu Linux 13.04 I'm having trouble mounting a partition that is very dear to me. My backup policy is to perform a backup about monthly, so I do have a backup from August :). Is there any way to recover the personal files that are on this drive? The drive is a 1.5 year old 1000 ...
There might still be hope, but your drive seems to have hardware problems (my interpretation of the read error in dmesg output). You should try to make a copy of what is recoverable from that partition onto another drive (to minimize disc access). Use ddrescue for that, it might take a while but gets most if not all o...
Short read while trying to open partition
1,643,300,188,000
In an ext4 filesystem, suppose that file1 has inode number 1, and that file2 has inode number 2. Now, regardless of any crtime timestamp that might be available, is it wrong to assume that file1 was created earlier than file2 only because inode 1 is less than inode 2?
Lower inode number doesn't prove older. A simple case that would change that sequence is deleting a file which would free the inode. That inode therefore becomes available for future use.
Does inode number determine what files were created earlier than others?
1,643,300,188,000
The ext2/3/4 filesystem checker has two options that seem to be very similar, -p and -y. Both seem to perform an automatic repair, but the manpage states that -p can exit when it encounters certain errors while for -y no such thing is mentioned. Is this the only difference?
There is a specific difference which when we read it twice might make more sense. -p - Automatically repair the file system without any questions. -y - Assume an answer of `yes' to all questions. So fsck -p will try to fix the file system automatically without any user intervention. It is most likely to take decisio...
What is the difference between fsck options -y and -p?
1,643,300,188,000
zerofree -v /dev/sda1 returned 123642/1860888/3327744. The man page does not explain what those numbers are: http://manpages.ubuntu.com/manpages/natty/man8/zerofree.8.html I found some code on github: https://github.com/haggaie/zerofree/blob/master/zerofree.c And there's this line: if ( verbose ) { printf("\r%u/%u/%...
I have the same tool installed on Fedora 19, and I noticed in the .spec file a URL which lead to this page titled: Keeping filesystem images sparse. This page included some examples for creating test data so I ran the commands to create the corresponding files. Example $ dd if=/dev/zero of=fs.image bs=1024 seek=200000...
zerofree verbose returns what?
1,643,300,188,000
I was running into performance problems with hundredthousands of files in single directories when I needed to do certain wildcard matches. From my applications point of view, a simple solution is to place the files in deeply nested folders. The expected upper bound for the total number of folders across the whole h...
Each folder consumes one inode (256 byte) and at least one block (probably 4096 byte). The bigger problem may be access time over several hierarchy layers. The performance problem is probably not due to the folder size but to pathname expansion. Pathname expansion has two problems: It sorts the results (which cannot ...
What is the "cost" of deeply nested folders in ext4?
1,643,300,188,000
Today I found an "empty" directory with a size of 4MB. It had no visible contents, so I tried ls -lah. This showed me some hidden files (not very large). Searching for the reason why the directory was so large I found that the dot file (.) had a size of 3.9MB. What gets stored in that file? Isn't that just a kind of l...
The dot file, like every directory, contains a list of names for the files in this directory and their inode numbers. So if you once had lots of files in that directory (not unlikely for a "tmp" directory) that would have made the directory entry grow to this size. After the files are gone, the file system doesn't au...
Why could the size of the "dot" file "." exceed 4096?
1,643,300,188,000
Faux pas: The "fast" method I mention below, is not 60 times faster than the slow one. It is 30 times faster. I'll blame the mistake on the hour (3AM is not my best time of day for clear thinking :).. Update: I've added a summary of test times (below). There seem to be two issues involved with the speed factor: ...
rm -r is expected to be slow as its recursive. A depth first traversal has to be made on the directory structure. Now how did you create 10 million files ? did u use some script which loops on some order ? 1.txt,2.txt,3.txt... if yes then those files may too be allocated on same order in contigous blocks in hdd.so del...
Why is deleting files by name painfully slow and also exceptionally fast?
1,643,300,188,000
I'm trying to mount a device but without success. The strange thing is that the mount command succeeds and return exit code 0, but the device is not mounted. Any idea on why this happens or how to investigate it? Please see the example below: [root@mymachine ~]# blkid -o list device fs_type label mount po...
Normally mount doesn't return 0 if there have been problems. When I had a similar problem, the reason was that systemd unmounted the filesystem immediately after the mount. You can try strace mount /dev/xvdx /vols/data5 to see the result of the syscall. You can also try mount /dev/xvdx /vols/data5; ls -li /vols/data5...
Why is mount failing silently for me?
1,643,300,188,000
I am using Linux as guest OS in VirtualBox. I deleted huge number of files from its filesystem. Now i want to shrink the filesystem image file (vdi). The shrinking works by compressing filesystem image wherever it has "null" value in disk. It seems an application called zerofree can write "null" into free space of fil...
The page you reference (http://intgat.tigress.co.uk/rmy/uml/index.html) states: The utility also works on ext3 or ext4 filesystems. So I'm not sure where you're getting that it doesn't work on ext4 filesystems. Note that the zerofree utility is different from the zerofree kernel patch that is mentioned on the same pa...
How to make ext4 filesystem sparse?
1,643,300,188,000
I want to try Btrfs. I've already found that you can make a snapshot of a live system but there are a few thing I haven't found answers for. Well, as I understand a snapshot basically a full copy in archive form of some sort. So can I make a snapshot of my live btrfs system and place that snapshot on my non btrfs hard...
A snapshot (in this sense) is a part of the filesystem. In btrfs terminology, it's a subvolume — it's one of the directory trees on the volume. It isn't in “archive form”. Making a snapshot of a subvolume creates a new subvolume which contains the data of the original volume at the date the snapshot was made. Subseque...
Btrfs snapshot to non-btrfs disk. Encryption, read acess
1,643,300,188,000
My program creates many small short-lived files. They are typically deleted within a second after creation. The files are in an ext4 file system backed by a real hard disk. I know that Linux periodically flushes (pdflush) dirty pages to disk. Since my files are short-lived, most likely they are not cached by pdflush. ...
A simple experiment using ext4: Create a 100MB image... # dd if=/dev/zero of=image bs=1M count=100 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 0.0533049 s, 2.0 GB/s Make it a loop device... # losetup -f --show image /dev/loop0 Make filesystem and mount... # mkfs.ext4 /dev/loop0 # mount /dev/l...
Are short-lived files flushed to disk?
1,643,300,188,000
I am partitioning a disk with the intent to have an ext4 filesystem on the partition. I am following a tutorial, which indicates that there are two separate steps where the ext4 filesystem needs to be specified. The first is by parted when creating the partition: sudo parted -a opt /dev/sda mkpart primary ext4 0% 10...
A partition can have a type. The partition type is a hint as in "this partition is designated to serve a certain function". Many partition types are associated with certain file-systems, though the association is not always strict or unambiguous. You can expect a partition of type 0x07 to have a Microsoft compatible f...
Why does parted need a filesystem type when creating a partition, and how does its action differ from a utility like mkfs.ext4?
1,643,300,188,000
I'm wondering if this is considered safe. I know the file handles work just fine as long as a link remains, and I know the identifier is the inode rather than the name, but I am not sure how it works across different FS. For example copying from an ext4 harddrive to a NTFS USB stick, or copying from a FAT stick to an ...
I am not sure how it works across different FS. The rename operation itself doesn’t operate across different file systems; there is no difference between writing to a file from say a text editor and writing to a file using cp with a source file on another file system. On Linux, the rename system call is transparent ...
Renaming a file while it is being written
1,643,300,188,000
I have a small "rescue" system (16 MB) that I boot into RAM as ramdisk. The initrd disk that I am preparing needs to be formatted. I think ext4 will do fine, but obviously, it doesn't make any sense to use journal or other advanced ext4 features. How can I create the most minimal ext4 filesystem? without journal with...
Or you could simply use ext2 For ext4: mke2fs -t ext4 -O ^has_journal,^uninit_bg,^ext_attr,^huge_file,^64bit [/dev/device or /path/to/file] man ext4 contains a whole lot of features you can disable (using ^).
Minimalistic ext4 filesystem without journal and other advanced features
1,643,300,188,000
How can we lock a symlink so it cannot be deleted? With a normal file/directory chattr +i /file/location can achieve this but doing so with a symlink we get chattr: Operation not supported while reading flags on my-file. There is a similar question, How to set `chattr +i` for my `/etc/resolv.conf `?, but without a sol...
This doesn’t provide a solution, but it explains why chattr can’t make a symlink immutable. On Linux, immutable attributes are part of a set of flags which are controlled using the FS_IOC_SETFLAGS ioctl. Historically this was implemented first in ext2, and chattr itself is still part of e2fsprogs. When it attempts to ...
How to make a symlink read only (`chattr +i /location/symlink`)?