Tag Info

Hot answers tagged

22

/proc is a filesystem because user processes can navigate through it with familiar system calls and library calls, like opendir(), readdir(), chdir() and getcwd(). Even open(), read() and close() work on a lot of the "files" that appear in /proc. For most intents and almost all purposes, /proc is a filesystem, despite the fact that its files don’t occupy ...


15

it's just an area of files containing information But that's exactly what a filesystem is. Filesystems don't have to be writable and they don't have to reside on permanent storage. Note: There's a distinction between procfs (the pseudo filesystem implementation in the kernel) and its conventional mount point /proc. You could in theory mount a procfs ...


14

A directory (like any file) is not defined by its name. Think of the name as the directory's address. When you move the directory, it's still the same directory, just like if you move to a different house, you're still the same person. If you remove a directory and create a new one by the same name, it's a new directory, just like someone who moves into the ...


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


13

3 or 4 fragments in a 900mb file is very good. Fragmentation becomes a problem when a file of that size has more like 100+ fragments. It isn't uncommon for fat or ntfs to fragment such a file into several hundred pieces. You generally won't see better than that at least on older ext4 filesystems because the maximum size of a block group is 128 MB, and so ...


10

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


10

To add Eric's answer (don't have rep to comment), permissions are not stored in file but file's inode (filesystem's pointer to the file's physical location on disk) as metadata along with owner and timestamps. This means that copying file to non-POSIX filesystem like NTFS or FAT will drop the permission and owner data. File owner and group is just a pair of ...


8

The new directory A is not the same as directory A. It can be checked with stat command before deleting old one and after creating new one and you will see different i-node numbers. And I think this is related to how kernel works. It simply keeps track of the i-number of the current directory for each process. So as there are different i-numbers this will ...


8

I can't truly answer but I think this might help: Notice how each fragment is, at most, 32768 blocks in size (a power of 2, that should raise a flag that something is going on, and also give you a hint for something to look for). Also worth noting, those physical offsets between extents are pretty close to each other. From: Ext4 Disk Layout An ext4 ...


7

This is expected behavior. The new directory A isn't the same as the old directory A, it just happens to have the same name. So the first terminal's $PWD is still gone, it didn't magically reappear when you did the mkdir A.


7

If data are organized in a way so they can be accessed via the mechanisms used for file systems you may well call the whole thing a file system.


6

1) Download and install Samba: apt-get install samba samba-common 2) Backup samba.conf: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 3) Edit samba.conf: nano /etc/samba/smb.conf Replace all with and edit it to your wishes: [global] workgroup = arbeitsgruppe server string = %h server (Samba %v) log file = ...


6

The command [ is another "name" for the command test, so that the syntax of if constructs look nicer. These two are equivalent: if test $x -eq 0 if [ $x -eq 0 ] The final ] is only syntactic sugar. The equivalence is mostly just a historic feature. Note that the newer test construct [[ ... ]] (which is non-standard) is part of the shell syntax, as ...


5

What is a bind mount? A bind mount is an alternate view of a directory tree. Classically, mounting creates a view of a storage device as a directory tree. A bind mount instead takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is ...


5

People don't use "file system" too carefully. In your examples, I would say that /, /bin and /proc are file systems because an entire partition (like /dev/sdb1) is mounted on those directories. My Arch linux system doesn't have /bin as a file system so this example isn't perfect but... % ls -lid /proc /home /boot / 2 drwxr-xr-x 17 root root 4096 Feb 24 ...


4

If one could that easily detect when sectors are about to go bad or do go bad, it would likely have been worked into the filesystem by now. Due to the nature of the error, it will often be silent. You need a filesystem that does checksumming. On GNU/Linux BTRFS may be a good bet since I looked online and apparently support was introduced in Debian 6. ...


4

That would depend on how you copy it. If you put it in a tar ball and copied that, then untarred it, tar will perserve permissions. If you use rsync it will also, depending on flags, perserve permissions. Those applications are responsible for the permissions. If you were to scp it permissions would not be preserved. The command doing the copying is ...


4

At the risk of grossly oversimplifying, A filesystem is like your car's engine and other internal systems, A directory structure is like a map of the places where you drive. Since I’ve been asked for an encore, Filesystems are like the mechanics (implementation details) of audio/video signal distribution/propagation: analog RF broadcast, digital RF ...


3

I would expect three /, hello and file. Changing permissions of any one of these can limit access to file.


3

Is there a Linux command that will force the stream to flush to the file? Not really, but the standard approach is to install a signal handler for, say, SIGUSR1. The signal handler would set a flag, then your program would check the flag once in a while, and flush the relevant streams, and perhaps also print some relevant state information.


3

You can install and configure the SMART monitoring tools. On Debian the package is called smartmontools. These won't prevent disk failure but they will help identify precursors to possible disk failure. There is no configuration in the package installation, so you need first to enable SMART monitoring in the file /etc/default/smartmontools: # uncomment to ...


3

The process of going from ext2 to ext4 is similar to your linked article for 3->4. You need to enable the features using tune2fs. The difference between going from 3->4 and 2->4 is that you also need to enable the journal feature. The complete command is this: tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sdxx You should fsck the filesystem ...


3

There used to be an option to check ext2 filesystems at mount time, but that is no longer supported. Nowadays boot scripts check filesystems before mounting them, and your scripts should do so too. Mounting a filesystem does still check things to make sure it's safe to mount the filesystem; but it won't fix anything (beyond replaying the journal on ext3 or ...


3

Whilst monitoring logging I have to go to my log files, order by written date, so I can then see the name of the log file for the most-recent execution of my application. I assume this means that the application writes log files like this: AFile1.log AFile2.log AFile3.log AFilex.log Is there any way, given a directory and sub-string, to return ...


2

If your question is actually about restoring a system after a crash, you can safely forget about tar: it has a limit to the maximum length of the paths that is hardcoded in the format specs, and it doesn't handle hardlinks. For similar reasons, you shouldn't try to do backups with cp, pax, cpio, or rsync. A reasonable solution is to use dump / restore, or, ...


2

Because you can't foresee when and where a disk is corrupted, the easiest way to prevent that your backup is overwritten by a corrupted copy is doing a rotating backup. So basically you can do daily backups to different locations. When you notice a disk fault and you have several backups to restore from, even if the last one is overwritten by a corrupted ...


2

My first comment is all of what you state will only work if the filesystem on the device you're interested in is currently mounted. But I guess you know that and accept that limitation. The method you propose seems quite thorough and I think it will catch all cases. About looking ip in /sys/dev/block: You're not looking for <maj>:0 as you state. ...


2

Assuming that there are no symbolic links or mount points involved Bill gives a good answer. If there are symbolic links involved, the number would be much higher. Also if there are mounts involved you would need two inodes per mount point instead of one.


2

By default, ext2/ext3/ext4 filesystems have 5% of the space reserved for the root user. This makes sense for the root filesystem in a typical configuration: it means that the system won't grind to a halt if a user fills up the disk, critical functionality will still work and in particular logs can still be written. It doesn't make sense in most other ...


2

Under most typical use cases, most filesystems created with default settings will have way more inodes than they will ever need. But that's actually a pretty good tradeoff considering: The inode table doesn't really waste all that much space, all in all. It's almost never worth reducing the number of inodes just to squeeze the last few bytes of available ...



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