Tag Info

Hot answers tagged

40

How do I tell what sort of data (what data format) is in a file? → Use the file utility. Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see ...


38

Another option is to use blkid: $ blkid /dev/sda1 /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2" This recognizes most filesystem types and stuff like encrypted partitions. You can also search for partitions with a given type: # blkid -t TYPE=ext2 /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2" /dev/sdb1: ...


28

You can use sudo parted -l [shredder12]$ sudo parted -l Model: ATA WDC WD1600BEVT-7 (scsi) Disk /dev/sda: 160GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 8587MB 8587MB primary ext3 boot 4 8587MB 40.0GB 31.4GB primary ext4 2 ...


13

Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list: # tune2fs -l /dev/sda1 | grep features If in the list you see: extent — it's ext4 no extent, but has_journal — it's ext3 neither extent nor has_journal — it's ext2 The parted and blkid answers are better if you want ...


13

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 filesystem. It also acts as a ...


13

The rename operation is very fast on any filesystem, so it is unlikely to be interrupted, but on a classical filesystem it certainly can be interrupted - if it creates the destination link first, it could leave two links on a file - which is legal, but the file thinks it only has one, which could cause problems if one is deleted later. On the other hand, if ...


12

The -T largefile flag adjusts the amount of inodes that are allocated at the creation of the file system. Once allocated, their number cannot be adjusted (at least for ext2/3, not fully sure about ext4). The default is one inode for every 16K of disk space. -T largefile makes it one inode for every megabyte. Each file requires one inode. If you don't have ...


11

First, let's dispel some myths. it is atomic so inconsistencies cannot happen Moving a file inside the same filesystem (i.e. the rename) system call is atomic with respect to the software environment. Atomicity means that any process that looks for the file will either see it at its old location or at its new location; no process will be able to ...


9

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 of file sizes and what your access ...


8

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=2000000 count=0 $ /sbin/mke2fs fs.image $ ls ...


7

try using df -T see man df for more options still one more way I found is cfdisk


7

you could have been writing to a file during a hard reset, or your hard drive could have problems. a fsck should fix it (you will have to umount the fs to do this). I'd check dmesg and smartctl -a /dev/hdx (latter is part of smartmontools ) to see if your HD is reporting any errors. I'd also run a non-destructive badblocks on the partition. You should also ...


7

To add to the other answers: Traditional Unix permissions are broken down into: read (r) write (w) execute file/access directory (x) Each of those is stored as a bit, where 1 means permitted and 0 means not permitted. For example, read only access, typically written r--, is stored as binary 100, or octal 4. There are 3 sets of those permissions, which ...


7

The purpose of reserving a small number of blocks for root's use only is to give root a chance to log in and give them a little bit of breathing room to make space in case the disk becomes completely full. Without it, root could be prevented from logging in because the login process fails when it gets unexpected errors writing files (like utmp and wtmp, ...


6

First rule of disk recovery: Stop using the disk. If there are hardware issues (such as a head crash), any usage risks further damage; if the filesystem is corrupt, any mount or fsck has the potential to make it worse. (Even in ro mode! Note that mount -t ext3 -o ro will attempt to playback the journal and write to disk!) Use dd_rescue or ddrescue to ...


6

There are many other advantageous features of ext3 and ext4 over ext2, other than journaling. If you are sure that your kernel won't crash, and you won't loose power, then you may choose to disable the journal, which you can do with ext4 and still keep the other benefits, rather than go back to ext2. The journal doesn't cost much though, so generally isn't ...


5

The journal is the difference. You can not have an ext3 filesystem without a journal. If you disable the journal, it becomes an ext2 filesystem again. ext4 has a number of beneficial features and can run without a journal, making it a much better choice.


5

You don't need to unmount the partition prior to doing this. Regarding question two, it depends. As HDDs have grown in size, so has the total amount of disk space that's reserved for root. If you have a 2 TB HDD and it's totally used for /, then I would say you could quite safely tune it down to 1% by doing this: $ sudo tune2fs -m 1 /dev/sda*X* A smaller ...


5

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 and ext2, making it possible to ...


5

Obviously tune2fs just configures the filesystem, it does not rewrite data on disk. And obviously without rewriting you do not get the same results. The ext4 features are applied to new data only. Thus if you really want all benefits then you have to backup the data, format the volume as ext4 (or make the changes with tune2fs and then delete all the data) ...


4

PhotoRec scans a disk (or disk image) searching for contiguous chunks of bytes-that-look-like-known-file-formats (for example, it can recognize JFIF/EXIF (JPEG) by the segment headers). Pretty simple but limited. The Sleuth Kit is a great tool for digging into filesystems. With a bit of care (and scripting its tools and hex-editing the disk image when it ...


4

Which permissions? Basic permissions fit in 16 bits; ext2 uses 32 bits, plus another 32 bits for file flags (chattr(1)); then POSIX ACLs use variable space in addition. See /usr/include/linux/ext2_fs.h for details. (ext3 and ext4 build on ext2 and mostly use the same structure.)


4

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 support ext4 on Grub legacy; the ...


4

The imap command in debugfs can tell you where an inode is. Example: $ debugfs -R 'imap <128901>' /dev/whatever debugfs 1.42.5 (29-Jul-2012) Inode 128901 is part of block group 16 located at block 524344, offset 0x0400 To get a raw dump of inode 128901, you'd seek to byte 524344*block_size + 0x0400 and read inode_size bytes. You can get the ...


4

bytes-per-inode determines how many inodes are created for that file system; inode-size determines how big each of those inode is. You need a lot of inodes if you intend to put lots of small files (&/or lots of directories) on the filesytem. AFAIK, you really only need inodes that are larger than the default size of 256 bytes if you want to store ...


4

Well, first, what is an inode? In the Unix world, an inode is a kind of file entry. A filename in a directory is just a label (a link!) to an inode. An inode can be referenced in multiple locations (hardlinks!). -i bytes-per-inode (aka inode_ratio) For some unknown reason this parameter is sometime documented as bytes-per-inode and sometime as inode_ratio. ...


3

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 is not preserved - data may be ...


3

Information about files are stored in a data structure called an inode. There is a field in this structure for the mode, which contains the permissions. This field on my system is an unsigned short which is 2 bytes and 16 bits. Take a look at fs.h in the Linux source to see for yourself.


3

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 name: <none> Last mounted on: ...


3

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 decisions such as yes or no by itself. ...



Only top voted, non community-wiki answers of a minimum length are eligible