Commands tagged ext4 (5)

  • Before doing this, back-up all data on any ext3 partitions that are to be converted to ext4. After running previous command you MUST run fsck, is needed to return the filesystem to a consistent state. fsck -pDf /dev/yourpartition Edit /etc/fstab and change the 'type' from ext3 to ext4 for any partitions that are converted to ext4.

    tune2fs -O extents,uninit_bg,dir_index /dev/yourpartition
    starchox · 2009-06-23 17:42:01 10
  • Return the creation date of a file on ext2, 3, 4 filesystems, because stat command won't show it. Useful on ubuntu, debian, and else Show Sample Output

    debugfs -R "stat <$(stat --printf=%i filename)>" /dev/sdaX | grep crtime
    pggx999 · 2015-04-09 01:23:56 3
  • For slow flash memory (cheap thumb drive), ext4 is the fastest stable file system for all use cases with no relevant exception: Since we can usually dispense with the benefits of a journal for this type of storage, this is a way to achieve the least awful I/O-speed. Disabling the journal for an existing ext4 partition can be achieved using tune2fs -O ^has_journal /dev/sdXN Note that it is often recommended to format removable flash media with ext2, due to the lack of a journal. ext4 has many advantages over ext2 even without the journal, with much better speed as one of the consequences. So the only usecase for ext2 would be compatibility with very old software.

    mke2fs -t ext4 -O ^has_journal /dev/sdXN
    michelsberg · 2013-02-15 17:24:02 1
  • XX is your device partition number like /dev/sdc1 . to see how many inodes your partition have type: df --inodes (or df -i) Default formatting with ext4 would create small inode count for the new partition if you need big count of inodes is the fstype news the correct one. in debian you can see which fstype exists as template in: vim /etc/mke2fs.conf if you format default ext for a partition size with 1TB you would get 1 Million inodes (not enough for backupStorages) but if you format with fstype news you would get hunderd of millions of inodes for the partition. you have tune /etc/sysctl.conf also with following sysconfig parameters fs.file-max = XXX fs.nr_open = XXX where XXX is the count of max inodes for whole system

    mkfs.ext4 -T news /dev/sdcXX
    aysadk · 2019-07-02 13:31:23 17
  • Find out the earliest installation time of a linux system by getting the / filesystem creation time. This example is only valid the os is installed on an ext2/3/4 filesystem.

    tune2fs -l $(df -P / | awk 'NR==2 {print $1}') | sed -n 's/^.*created: *//p'
    forcefsck · 2012-05-31 12:12:35 1

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

re-assign line numbers

Remove any RPMs matching a pattern
This should be an option to rpm, but isn't. I wind up using it a lot because I always forget the full name of the packages I want to delete.

Convert all .wav to .mp3
Audio convert is a script that uses zenity and lame to transcode virtually any format to any other format provided you have the libraries installed to do so.

make sure you don't add large file to your repository

Load average + API google chart
limite = threshold

Display information sent by browser
Have netcat listen on port 8000, point browser to http://localhost:8000/ and you see the information sent. netcat terminates as soon as your browser disconnects. I tested this command on my Fedora box but linuxrawkstar pointed out that he needs to use $ nc -l -p 8000 instead. This depends on the netcat version you use. The additional '-p' is required by GNU netcat that for example is used by Debian but not by the OpenBSD netcat port used by my Fedora system.

delete PBS jobs based on strings from qstat output

Find duplicate UID in /etc/passwd
You can use only awk

Colour part of your prompt red to indicate an error
If the return code from the last command was greater than zero, colour part of your prompt red. The commands give a prompt like this: [user current_directory]$ After an error, the "[user" part is automatically coloured red. Tested using bash on xterm and terminal. Place in your .bashrc or .bash_profile.

du and sort to find the biggest directories in defined filesystem
I had the problem that our monitoring showed that the "/" filesystem is >90% full. This command helped me to find out fast which subdirs are the biggest. The system has many NFS-mounts therefore the -x.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: