Tag Info

Hot answers tagged

16

autofs can do this for you. You can configure any number of mountpoints with various options, and the corresponding filesystems are mounted whenever the mountpoint is accessed. After a given amount of inactivity the filesystems are unmounted again. There are no doubt various ways of using autofs, but here's one way of doing what you're trying to do, based ...


11

Many entities in *nix style (and other) operating systems are considered files, or have a defining file-like aspect, even though they are not necessarily a sequence of bytes stored in a filesystem. Exactly how directories are implemented depends on the kind of filesystem, but generally what they contain, considered as a list, is a sequence of stored bytes, ...


10

In the Unix Way of Doing Things: everything is a file. A directory is one (of many) type of special file. It doesn't contain data. Instead, it contains pointers to all of the files that are contained within the directory. Other types of special files: links sockets devices But because they are considered "files", you can ls them and rename them and ...


8

You can do this with systemd, so you don't have to install extra software and just have a small amount of extra configuration. Simply add noauto,x-systemd.automount to the options in fstab. noauto to not mount automatically on boot and x-systemd.automount to let systemd mount it on access. Source: ArchWiki - fstab


7

Another approach is with findmnt: findmnt /dev/sda4 ...to get mountpoint from dev. Or vice-versa: findmnt /home


6

You can use: mount for a list of all mounted filesystems and mount options for each of them; lsblk for a tree of block devices, size and mount point (if mounted); df for a list of mounted block devices, size, used space, available space and mount point.


4

If you can't take the system down for maintenance, that is a very hard task to actually move the system files while they are being used (if at all possible). If you can take the system down for maintenance, I can think of two ways: Booting a rescue system You will need to boot from another system, maybe a rescue disk or something like gparted, then mount ...


4

This is because your test is flawed. Running find . merely calls getdents() on the directory tree. A directory in this case is just a file that contains directory entries and is thus stored in page cache. Note you do nothing to actually access the files you are attempting to cache in this manner. Your test is basically caching all the directories in the ...


4

You're actually asking two questions. The easiest thing to do if you want to know where your home is: cd df -h . Or df -h $HOME Where is /tmp mounted? df -h /tmp ...etc. If you want to know what is mounted on a certain device, mount | grep ^/dev/sda1 (for example). Or mount | grep ^/dev/sd to see all the sd's.


3

The offset option of mount does not get passed to mount directly, but to losetup which sets up a loop device which refers to the offsetted location of the underlaying block device. Mount then performs its operations on that loop device rather than the raw block device itself. You can also use losetup to make resize2fs play which such file systems: # ...


3

You can try the following to create a case insensitive filesystem in /tmp: truncate -s 100M /tmp/vfat losetup /dev/loop0 /tmp/vfat mkfs.vfat /dev/loop0 mkdir /mnt/vfat mount /dev/loop0 /mnt/vfat If you don't want to use tmpfs but ramfs instead, create a RAM mount first: mkdir /mnt/ramfs mount -t ramfs -o size=110M ramfs /mnt/ramfs Then follow the steps ...


3

Depends on what you're after. If you want to check which of the partitions in /dev/sd* has a default mountpoint and what that mountpoint is, you could do for part in /dev/sd*; do grep -w "$part" /etc/fstab | awk '{print $1,$2}; done However, on most modern systems, partitions are mounted by UUID and not dev name, so a better approach1 would be: for uuid ...


3

My answer is mere reminiscence, but in 199x vintage Unixes, of which there were many, directories were files, just marked "directory" somewhere in the on-disk inode. You could open a directory with something like open(".", O_RDONLY) and get back a usable file descriptor. You could parse the contents if you scrounged through /usr/include and found the ...


3

I wrote this bash script to do it. It basically forms an array containing the names of the files to go into each tar, then starts tar in parallel on all of them. It might not be the most efficient way, but it will get the job done as you want. I can expect it to consume large amounts of memory though. You will need to adjust the options in the start of the ...


2

You can use mount command. It also shows options with which the mounting is done.


2

You're looking for the df command.


2

A file rename that doesn't cross file system boundaries is just a metadata change, so it should preserve the inode number. Generally speaking, opening a file and modifying its contents should not change its inode number, which only makes sense within a single file system anyway (but it will change the access times, for example). Note that some tools such as ...


2

The short answer is that encrypted volumes are not really more at risk. The encrypted volumes have a single point of failure in the information at the beginning of the volumes that maps the password (or possibly several passwords for systems like LUKS) to the encryption key for the data. (That is why it is a good idea to encrypt a partition and not a whole ...


2

Your file system is very unlikely to be corrupted. Ext4fs, like most Unix file systems supports sparse files, i.e. files which have some of their blocks not backed by any physical media and which blocks by convention are returned as containing only null values (zeroes) when read. Removing a sparse file represent no specific risk, outside the fact it might ...


2

You normally can't remount a filesystem as read-only if processes have a file on it that's open for writing, or if it contains a file that's deleted but still open. Similarly, you can't unmount a filesystem that has any file open (or similar uses of files such as a process having its current directory there, a running executable, etc.). You can use umount ...


2

A directory is special in that it has the 'd' in its mode, telling the filesystem that it should interpret its contents as a list of other files contained within the directory, rather than a regular file that is just a sequence of bytes to be read by the application. That is all.


2

Here's another script. You can choose whether you want precisely one million files per segment, or precisely 30 segments. I've gone with the former in this script, but the split keyword allows either choice. #!/bin/bash # DIR="$1" # The source of the millions of files TARDEST="$2" # Where the tarballs should be placed # Create the million-file ...


1

You can use the ciopfs stackable filesystem, which implements a case-insensitive filesystem on top of a case-sensitive one. mkdir /tmp/case-sensitive /tmp/case-insensitive ciopfs /tmp/case-sensitive /tmp/case-insensitive TMPDIR=/tmp/case-insensitive myapp fusermount -u /tmp/case-insensitive Ciopfs is a FUSE filesystem, which is available on most Unix ...


1

The exact answer depends on your filesystem - but in short, your data is stored in blocks. Your filesystem's metadata contains pointers to those blocks. It's OK if those blocks aren't consecutive - if your pointers are to block 3,4,5,6 it's no different than if they point to 3,28,110,45. It's only the number of blocks that determines how much space is ...


1

I think your confusing mount points and filesystem semantics. The answer is yes though. Symbolism has nothing to do with file systems or mount points. See http://en.m.wikipedia.org/wiki/Symbolic_link


1

Sure can, unless target/source filesystem do support soft links.


1

You can't use inode to check if a file has been changed. It may or may not change when a file is renamed, or moved. It will typically stay the same unless moved onto another disk ...


1

A gpg solution would be to decrypt a file to standard output, and pipe it to your program. This requires the program to read for stdin, which may not be the case. I made an alias for this on my system: $ gpg -q --output - $ alias gpgcat='gpg -q --output -' Then... $ gpgcat encryptedfile.gpg | ./myprogram From user236012's comment, you could write the ...


1

It is impossible to dissociate the contents of the file from the inode which contains the file's metadata (timestamps, owner, permissions, etc.). Most metadata would be problematic if there was more than one set: not just the size (which obviously needs to match the content), but the modification time (which would have to be updated in every inode when the ...


1

For Ext4 a hard-link simply refers to an inode, which contains all the metadata. Therefore you cannot have different metadata using hard links. I'm not sure what exactly you are trying to do, but you could have a look at git, zip, or soft-links. All of them have ways of handling duplicated data.



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