Tag Info

Hot answers tagged

12

I guess you got that one letter into the file with echo a > file or vim file, which means, you'll have that letter and an additional newline in it (two characters, thus two bytes). ls -l shows file size in bytes, not blocks (to be more specific: file length): $ echo a > testfile $ ls -l testfile -rw-r--r-- 1 user user 2 Apr 28 22:08 testfile $ cat -A ...


9

You can't convert, but can reformat the partition. Boot into Ubuntu or from a live CD and format the partition from there. Be careful not to format the wrong partition. mkfs.ext3 /dev/hdx1


7

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


6

It can be partially accomplished by piping the grep command to lsattr command. lsattr -R | grep +i However, I believe when you mention the entire ext3 file system the search might involve /proc , /dev and some other directories which if reports some error you just want to ignore. You can probably run the command as, lsattr -R 2>/dev/null | grep -- ...


6

I think that the deep answer is the following: Logical file length and disk space occupied are really different things. As the other answer shows, in principle a file created with two bytes has length two bytes (show by ls -l) and occupy 4 KiB ( show by duor ls -ls). See: 1& [:~/tmp] % echo -n A > test 1& [:~/tmp] % ls -l test ...


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


5

When setting up a disk or partition there are 2 aspects to doing this. The first is the act of laying down a partition table scheme on the disk using typically either MBR (Master Boot Record) or GPT (GUID Partitioning Table) formats. Both of these lay down a "structure" on the disk. MBR If you take a look at the structure of an MBR you'll notice that ...


4

The id in the partition table doesn't have to have anything to do with what's actually in the partition. For example, there's no type for an XFS filesystem -- people just use "linux" (83). fdisk will say HPFS/NTFS until you change the partition type: fdisk /dev/sdb t 1 83 w And then reboot, or reattach the drive. (make sure it's not mounted first)


4

ls -l is just a long format. ls -ls is used to display the block size. Testing echo "1" > 1.txt bash-3.2$ ls -l 1.txt -rw-rw-r-- 1 ramesh ramesh 2 Apr 28 15:15 1.txt As we can see the size of the file is listed as 2B. However, if you need to check the block size, you need to run the below command. bash-3.2$ ls -ls 1.txt 4 -rw-rw-r-- 1 ramesh ...


4

According to Limits on Table Size the maximum size of a table on Linux 2.4+ using ext3 is 4TB. Since MyISAM stores the row data in one file and the index in another file, I guess this is the maximum theoretical size of the data+index. Since ext3 limits files to 2TB, it doesn't seem possible that the row data could exceed this.


3

To deal with arbitrary file names (including those containing newline characters), the usual trick is to find files inside .//. instead of .. Because // cannot normally occur while traversing the directory tree, you're sure that a // signals the start of a new filename in the find (or here lsattr -R) output. lsattr -R .//. | awk ' function process() { ...


3

Given that the purpose of the script is auditing, it is especially important to deal correctly with arbitrary file names, e.g. with names containing newlines. This makes it impossible to use lsattr on multiple files simultaneously, since the output of lsattr can be ambiguous in that case. You can recurse with find and call lsattr on one file at a time. ...


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


3

Won't work nowadays. Modern disks "hide" bad blocks (even the most carefully manufactured new disks have them, they are unavoidable with current data densites) by remapping them to spares. You'll "see" bad blocks only when the disk runs out of spares, and in my experience that means that 99% of the time the disk has hours (at best) left before joining the ...


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

Beyond the wear and tear on the HDDs I can't see any reason why this would be dangerous. I've never come across a EXT3/EXT4 parameter that limits the amount of times you can do this. There isn't any counter I've seen either. In looking through the output from tune2fs I see nothing that I would find alarming which would lead me to believe that performing ...


2

You can run inoticoming to watch for files placed in the directory and automatically run any command, in this case chattr. (note linux specific)


2

THIS ENDED UP BEING A HARDWARE ISSUE Switching to the new shielded cables did not help, but replacing the old card with this one: http://www.amazon.com/gp/product/B000NTM9SY did get rid of the error messages and the strange behavior. Will post something new if anything changes. IMPORTANT NOTE FOR SATA ENCLOSURES: Even after doing the above, any drive ...


2

Is there some way, either general or specific, that I can verify that none of the files on my filesystem were damaged? Without copies of the files to refer to, I think this is impossible. Have you looked in /lost+found? If anything was corrupted into pieces, those pieces will be left there by fsck. I have seen this happen before too, and as far as I ...


2

Thanks to Ramesh, slm and St├ęphane for pointing me in the right direction (I was missing the -R switch for lsattr). Unfortunately, none of the answers so far worked correctly for me. I came up with the following: lsattr -aR .//. | sed -rn '/i.+\.\/\/\./s/\.\/\///p' This protects against newlines being used to make a file appear as being immutable when ...


2

df reports the percentage of used blocks relative to the blocks not reserved for root use (by default I think it's 5% of the drive in ext3). It can be changed by using the -m option of tune2fs e.g. to set it to 2% tune2fs -m 2 /dev/sdXY The reserved blocks allow system daemons to keep going even when the disk is full, while non-root processes will not be ...


2

What does commit really do? I think one of the best explanations was given here by allquixotic. Are there really advantages of increasing it (like responsiveness and power savings)? May it actually cause data loss? As per the ext4 official documentation: Ext4 can be told to sync all its data and metadata every 'nrsec' seconds. The default ...


1

TL;DR: it is not likely with the default mount options but it still may happen. If you tune the mount options and set unsafe flags, yes it is possible. ext3 is a journaled filesystem meaning that it is less likely to be corrupted by a hard power-off than ext2 for instance which is not using journaling. That being said, it is not impossible for an ext3 ...


1

See these 2 pages for a bit more information; they are a bit dated, but should answer some of your questions as far as I can tell: https://www.debian-administration.org/article/643/Migrating_a_live_system_from_ext3_to_ext4_filesystem https://ext4.wiki.kernel.org/index.php/Ext4_Howto#Converting_an_ext3_filesystem_to_ext4


1

But what I'd like to know is whether or not all of my files on it are fine. Ext3 has no functionality for this, but questions like that come up in IT-security as well. The solution there is to create a list of hash-sums (i.e. practically unforgeable checksums) over the files and its meta-data and compare these stored sums with the actual sums at times ...


1

Not a direct answer but in looking at the output of tune2fs -l ... for each type of filesystem shows the following differences. Filesystem features EXT2 Filesystem features: ext_attr resize_inode dir_index filetype sparse_super EXT3 Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super ...


1

One likely reason for running out of inodes is that a large number of files has accumulated in a particular directory for whatever reason. You could check the usual suspects, eg /tmp, /var/tmp, /var/log etc. If you don't find anything, here is a command that I have cobbled together to list the top 50 directories in the filesystem containing the most ...


1

Looking at the comments others have helped you diagnose you're out of inodes. If you need to make a few available so you can get some basic access back to your system then you could delete the following files on a CentOS 5 install, assuming you can live without them. Example $ sudo rm -fr /var/log/*.[1-9]?(.gz) This will remove any of the previously ...


1

Why? Because no one has written a tool that does it. And that's probably because it's a not entirely trivial change to the filesystem metadata. There are other issues like this; for example you can't resize ext4 to >16TB. That needs 64bit structures which aren't used by default. Same with other filesystems, for example you can't shrink XFS. None of these ...



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