We all know that mounting a new partition as /home and maybe /boot is extremely useful. Or mounting a remote directory as /opt can be great for sharing system tools. Are there any other, maybe more esoteric, uses for extra partitions or hard drives or nifty ways to mount external volumes? Maybe even if anyone also has windows machines *shudder*, post some cool tricks involving partitioning and hard drive mounting.
9 Answers
FUSE (Filesystem in USErspace) allows many things to be accessible as ordinary files (not an exhaustive list by any means):
- remote files accessed via FTP
- remote files accessed via ssh
- remote files accessed via WebDAV
- files in archives
- files inside a non-running virtual machine image with xmount
- anything that looks like a file to a Gnome application
- Blogger blogs
- Flickr
There are also many FUSE filesystems that present a view of another filesystem with filtering, renaming or modified metadata or content:
- Keep copies of all past versions of files with copyfs, waybackfs, ...
- Log every action with loggedfs
- Encrypt files transparently with encfs
- Convert audio content with mp3fs
- See a read-only view or change permissions with bindfs
- See a partial read-only view with rofs-filtered
- Convert file name character sets with convmvfs
- Get a case-insensitive view with ciopfs
More possibilities on the FUSE site and elsewhere. You can also easily define your own in Erlang, Haskell, Lisp, Lua, Ocaml, Perl, Python, ...

- 829,060
Most unices have a logical volume manager. Use it.
Filesystems are now designated by meaningful names (like
/dev/mapper/darkstar-home
) rather than through drive letters (like/dev/sda1
, oops, it's now/dev/sdb1
because I booted with an external disk plugged in) or with safe but meaningless UUIDs.Want to move a filesystem to a different disk? Create a physical volume on the new disk, add it to the volume group, and move the logical volume onto the new physical volume. All done without downtime, no unmounting required.
When you make a backup, take a snapshot of the disk and run your backup from the snapshot. That way the backup is a consistent view of the filesystem (i.e., there really was a point in time when the filesystem was in that state). This doesn't hold with naive backups (e.g. file A is backed up, then a program modifies first A then B, then B is backed up: the backup has the new B and the old A).
Need to enlarge a filesystem? Logical volumes don't need to be contiguous, so all you need is enough free space, never mind where.

- 829,060
You have someone who can only access your server over ftp and are confined to their home directory but you realise they they need access to some other directory not in their home folder.
For example bob has ftp access to your web server, but also you want to let him view the log files in /var/logs/httpd/vhosts/bobssite.com/. It is a hassle to reconfigure everything so that apache writes logs for bobssite.com to bobs home folder but you can use the bind option to remount the folder like this
mkdir /home/bob/logs
mount --bind /var/logs/httpd/vhosts/bobssite.com /home/bob/logs/

- 581
-
3You can also use bindfs, which is more flexible: you don't need to be root to use it, and it can change ownership and permissions on the fly. – Gilles 'SO- stop being evil' Sep 25 '10 at 00:32
Most unices clean /tmp
on boot. If you do this, there isn't much point in storing the contents of /tmp
on disk in the first place. Many unices allow a filesystem to be stored in memory (the data will be written in the swap if necessary). For some reason, even though Linux has tmpfs
for this, most distributions don't mount /tmp
as tmpfs
. It's easily remedied with a line in /etc/fstab
:
tmpfs /tmp tmpfs mode=1777
By default, the filesystem can grow up to half your RAM. If you have a lot of swap, you might want to allow it to contain bigger files, e.g. to allow up to 2 GB:
tmpfs /tmp tmpfs mode=1777,2g
(Making the filesystem larger has a negligible overhead; the virtual memory usage grows as needed. It's still a good idea to have a limit because a runaway program could fill it very fast, and it's better to run out of /tmp
than to run out of memory available for processes.)

- 829,060
-
You might want to add
size=512MB
or something similar to the options. By default tmpfs takes half your RAM which is more that you might want for a reduced little throw-away filesystem – tante Sep 28 '10 at 12:24 -
1Why would you want to reduce the maximum size of the filesystem even more than the default (which is very conservative: you might want to store files up to your virtual memory size)? (Note that the memory required for the filesystem is the memory required to store the actual data and metadata, plus something like 10–100kB of overhead (measured on a mostly idle Ubuntu 10.04 i386 system).) – Gilles 'SO- stop being evil' Sep 28 '10 at 18:14
If your OS supports it, make all your filesystems on RAID 1 arrays, even if you they're not replicated. That way, if you ever need to transfer the filesystem to a different disk, you can do it online and quickly by adding the partition on the second disk to the array, rebuilding the array and removing the first disk.
Some LVM systems can mirror volumes, so you don't need another layers. ZFS does it without any external help.

- 829,060
Performance related:
Avoid file access time writing:
-o noatime
Usability related:
You can use alternative device names, e.g. labels or uuids.
For example to identify my MP3 player I use this device name in my fstab:
UUID=0C9F-6901
You can print the uuids of connected devices via the blkid command.
Analogous to that you can set a label at mkfs time or later via e2fstune and comparable tools. Then you can use
LABEL=mylabel
in the fstab or at the command line.

- 57,532
Mount an .iso image as a loopback filesystem. I keep a number of .iso files around, and this can be a handy way to copy reference files on the disk image.
stefan@host1:~ $ ls -ld ubuntu-10.04-server-amd64.iso
-rw-r--r-- 1 stefan staff 710412288 2010-06-27 11:51 ubuntu-10.04-server-amd64.iso
stefan@host1:~ $ mkdir ./ubuntu-10.04-server-amd64
stefan@host1:~ $ sudo mount -o loop ubuntu-10.04-server-amd64.iso ./ubuntu-10.04-server-amd64
stefan@host1:~ $ ls ubuntu-10.04-server-amd64
cdromupgrade doc isolinux pics preseed ubuntu
dists install md5sum.txt pool README.diskdefines
Or, if I want to read an offline copy of the installation manual, I can do that from the commandline:
stefanl@host1:~ $ links ubuntu-10.04-server-amd64/doc/install/manual/en/index.html

- 19,754
- 24
- 70
- 85
An oldie. Keep your software on one disk, and your data on another. Therefore you can seek both at the same time. Makes for faster disk access.

- 2,209
I like to have a separate partition for all personal data which I don't have to backup, e.g. svn checkouts, copies of data which mainly resides on an other server etc

- 8,790