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.


    5
    tune2fs -O extents,uninit_bg,dir_index /dev/yourpartition
    starchox · 2009-06-23 17:42:01 14
  • 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


    3
    debugfs -R "stat <$(stat --printf=%i filename)>" /dev/sdaX | grep crtime
    pggx999 · 2015-04-09 01:23:56 10
  • For slow flash memory (cheap thumb drive), ext4 is the fastest stable file system for all use cases with no relevant exception: http://www.linuxplanet.com/linuxplanet/tutorials/7208/1 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.


    2
    mke2fs -t ext4 -O ^has_journal /dev/sdXN
    michelsberg · 2013-02-15 17:24:02 6
  • 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


    1
    mkfs.ext4 -T news /dev/sdcXX
    aysadk · 2019-07-02 13:31:23 37
  • 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.


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

What's this?

commandlinefu.com 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

Find number of computers in domain, OU, etc .

Show current network interface in use

Extracting a range of pages from a PDF, using GhostScript
In this example we extract pages 14-17

Convert embedded spaces in filenames to "_" (underscore)
This command converts filenames with embedded spaces in the current directory replacing spaces with the underscore ("_") character.

Fetch the current human population of Earth

Make changes in any profile available immediately/Change to default group
Changes your group to the default group, has the same effect as sourcing your profile/rc file (in any shell) or logging out and back in again.

Extract dd-image from VirtualBox VDI container and mount it
Tested with NTFS and found on this site: http://forensicir.blogspot.com/2008/01/virtualbox-and-forensics-tools.html The first 32256 bytes is the MBR

Get all available packages on Ubuntu (or any distro that uses apt)

Recursively remove .svn directories

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: