Tag Info

Hot answers tagged

31

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: ...


25

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


24

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. You'll see output like this: # file -s /dev/sd* /dev/sda1: Linux rev 1.0 ext4 filesystem data, ...


11

use lsof to find the deleted, but open, file still consuming space lsof | grep deleted | grep etilqs_1IlrBRwsveCCxId chrome 3446 user 128u REG 253,2 16400 2364626 /var/tmp/etilqs_1IlrBRwsveCCxId (deleted) find the entry in /proc//fd/ that cooresponds to the filehandle ls -l ...


11

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


10

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


9

No. ext3fs doesn't support block fragmentation so a one byte file will use a whole 4096 block. On the opposite, for example UFS supports four fragments in a block so small files won't fill a file system as fast as they will do on ext3fs. This is unrelated to disk fragmentation which is about file data blocks not being contiguous and sequential.


9

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


9

These days ext4 is considered the stable standard, and you should use it. Also all filesystems use delayed writing, ext4 just delays allocating where the blocks go until they are actually written, which helps reduce fragmentation. It also uses extents to track the blocks, which makes it more efficient.


8

I think you're confused, possibly because you've read several documents that use different terminology. Terms like “block size” and “cluster size” don't have a universal meaning, even within the context of filesystem literature. Filesystems For ext2 or ext3, the situation is relatively simple: each file occupies a certain number of blocks. All blocks on a ...


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

First, you're right to suspect that “all data” doesn't mean the whole file. In fact, that layer of the filesystem operates on fixed-size file blocks, not on whole files. At that level, it's important to keep a bounded amount of data, so working on whole files (which can be arbitrary large) wouldn't work. Second, there's a misconception in your question. The ...


7

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 such. This enables e2fsck to ...


6

Actually yes. Since ext2 and ext3 are fairly similar, with the major difference being ext3 supports journalling, you should be able to: tune2fs -j ./system.img Which enables journalling. The conversion process is detailed here with the usual disclaimers about important information, messing with filesystems etc. You can actually go back to ext2 too, if ...


6

If you want to ensure fragmentation but not prevent it (so you only have partial control over what happens), and you don't care about the specifics of the fragmentation, here's a quick & dirty way of doing things. To create a file of n blocks in at least two fragments: Open the file with synchronous writes, write m < n blocks. Open another file. ...


6

On an ext4 filesystem (like ext2, ext3, and most other unix-originating filesystems), the effective file permissions don't depend on who mounted the filesystem or on mount options, only on the metadata stored within the filesystem. If you have a removable filesystem that uses different user IDs from your system, you can use bindfs to provide a view of any ...


6

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

The good thing about linux is the source is always somewhere. You can download or view the base e2fsprogs sources on kernel.org. This can also depend on your specific version and distribution though... From current code it looks like it's some value added to 20 based on the UUID of the partition, if you have enable_periodic_fsck = 1 in your mke2fs.conf ...


6

Don't get misled by the fact that only writeback mentions internal filesystem integrity. In ext3, whether you use journal, ordered or writeback, file system metadata is always journalled and that means internal file system integrity. The data modes offer a way of control over how ordinary data is written to the file system. So, if data integrity is your main ...


5

First I would double check that the disk is structured as you think it is from a partitions perspective. Typically the command: $ fdisk -l /dev/sdb For example: $ sudo fdisk -l /dev/sda Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size ...


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


4

The program calling the Linux partition "unallocated" sounds like the Windows Disk Management tool. Microsoft could make it recognize non-Microsoft partition types, but they haven't. It may be that your Ubuntu partition is still there and unharmed. If that is the case, you may just have to mark the Ubuntu /boot partition active. The Windows tool will ...


4

lsattr -v invokes the EXT2_IOC_GETVERSION ioctl for the file. This, in turn, retrieves the inode's i_generation field. This is a feature primarily intended for use with NFS: each time an inode gets allocated, one has to make sure it gets a new generation. Otherwise, NFS clients with stale file handles may manage to access data that weren't meant for them. ...


4

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


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

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

Inode data are usually scattered around the disk (in order to cut down seeks). Being able to tell where the inode structures are is the core functionality of a filesystem driver - check LXR for current implementation of ext3 in Linux) or e2fsprogs sources if you are interested in details. From a user's perspective you might want to take a look at dumpe2fs ...


4

Both ext3 and ext4 are journaling filesystems, in addition this list several differences, the most relevant are: Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte). Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 ...


4

From the mount manpage, -r, --read-only Mount the filesystem read-only. A synonym is -o ro. Note that, depending on the filesystem type, state and kernel behavior, the system may still write to the device. For example, Ext3 or ext4 will replay its journal if the filesystem is dirty. To prevent this ...


3

Run parted: parted /dev/sdc and do the following in it: mklabel gpt mkpart primary ext3 4MiB -1MiB quit Only then try to format it: mkfs.ext3 /dev/sdc1 As a side note: fsck on a 2.5TB partition will take a long long time, use ext4 if you can, jfs or xfs otherwise.



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