In your login shell's profile files you can set up some things that you will use during your session, and which only need to be done once. Some ideas:
- create a temporary file containing the IP address you connected from, later on you can include it in some scripts setting firewall rules.
- run ssh-agent, ask for your SSH keys, and store the SSH agent environment variables in a file.
- if that is a limited machine, and your co-workers want to be aware of each others logins, write(1) messages informing them of your login.
In a non-login shell's files (.bashrc
) you should configure your shell:
- Fancy prompt
- set aliases
- set history options
- define custom shell functions
- export environment variables, (maybe PAGER, EDITOR if system-wide settings suck)
- load ssh-agent variables saved in
.bash_profile
Usually, you would include .bashrc
from .bash_profile
with the following. Then login shell gets all your customizations, and .bash_profile
file does not have to duplicate things that are already in .bashrc
.
[[ -f ~/.bashrc ]] && . ~/.bashrc
On hard disks, throughput and seeking is often faster towards the beginning of the disk, because that data is stored closer to the outer area of the disk, which has more sectors per cylinder. Thus, creating the swap at the beginning of the disk might improve performance.
For a 2.6 Linux kernel, there is no performance difference between a swap partition and an unfragmented swap file. When a swap partition/file is enabled by swapon, the 2.6 kernel finds which disk blocks the swapfile is stored on, so that when it comes time to swap, it doesn't have to deal with the filesystem at all.
Thus, if the swapfile isn't fragmented, it's exactly as if there were a swap partition at its same location. Or put another way, you'd get identical performance if you used a swap partition raw, or formatted it with a filesystem and then created a swapfile that filled all space, since either way on that disk there is a contiguous region used for swapping, which the kernel uses directly.
So if one creates the swapfile when the filesystem is fresh (thus ensuring it's not fragmented and at the beginning of the volume), performance should be identical to having a swap partition just before the volume. Further, if one created the swapfile say in the middle of the volume, with files on either side, one might get better performance, since there's less seeking to swap.
On Linux, if the swapfile is created unfragmented, and never expanded, it cannot become fragmented, at least with normal filesystems like ext3/4. It will always use the same disk blocks, which are contiguous.
I conclude that about the only benefit of a dedicated swap partition is guaranteed unfragmentation when you need to expand it; if your swap will never be expanded, a file created on a fresh filesystem doesn't require an extra partition.
Best Answer
This is called slack space:
So, if your filesystem allocates space in units of 64 KB, and you store a 3 KB file, then:
Note: Some filesystems support block suballocation, which helps to mitigate this issue by assigning multiple small files (or the tail ends of large files) into the same block.