First: you don't mount partition. The thing that is mounted is filesystem. Filesystem may live on a partition but that's not necessarily so; filesystems commonly live:
inside file (e.g. ISO images),
entirely in RAM (e.g. /tmp is sometimes created this way),
inside kernel (/sys and /proc work this way),
or as a network service (NFS and Samba work this way).
To mount a partition c onto the mount point /a/b means "hanging" /c
onto the /a/b branch, resulting in /a/b/c
This is incorrect.
First, there are many ways to refer to the filesystem (for example, most common -- and safest in most cases -- way is using UUID, try running lsblk -o +UUID,LABEL
as normal user to see IDs your kernel knows about) but none of them have implications on the actual resulting path.
So when mounting, you provide a path (that path is called mountpoint and must already exist). After the filesystem is mounted, its root becomes accessible at that very path you provided --- not a subdirectory of it.
- Can we only mount a whole partition, or can we do with a part of that
partition ? Please elaborate.
In theory, you could have multiple filesystems on a single partition but then you'd need specific software to be able to find it there (truecrypt used to do this, IIRC).
If you want to mount only part of a filesystem, then again, in theory it could be possible but kernel does not do it like this. In theory you could devise a filesystem that allows to be mounted only partially and then write a driver for it but I guess it would be between hard and impossible. AFAIK, none of commonly used filesystems support this.
- Do we mount a partition onto another already-mounted partition?
Yes, you can do it. You can mount any number of filesystem over the same path and unmount them in any order. Only the last mounted filesystem will be accessible, though.
Actually it's done commonly by some programs e.g. for security reasons: mount a filesystem, open a file on it, then mount something else over the same path. Now no other process can access the first file.
For example some d mounted on /mnt, now can I mount another /e onto d,
creating /mnt/d/e ? Or we can/should only mount to "fixed branch" such
as /, /mnt ? If it is possible, what will happen if we unmount /d, will
/e be automatically unmounted as well ?
If you mount a filesystem on /mnt, and that filesystem happens to contain eg. directory 'foo', then you can use this directory to mount another filesystem. But kernel won't let you unmount a filesystem that is being used. Opening a file, having a process chdir to a directory and using a directory as a mount point all count as "being used".
mount to "fixed branch" such as /,
Oh, and by the way, never ever do this. Don't mount anything directly to /; this would most likely immediately break your system.
- Can we mount onto something with a different filesystem
Yep. In fact, with any common distribution, by the time you get to the login screen, you have about 5 different filesystems (heh, it's 16 on my Fedora box right now) mounted somewhere under /.
Run mount
to see what filesystems are currently mounted.
- Let's say a device sda having 2 partitions sda1, sda2. In common
practice, would people mount at any mount point they want such as
/sda1 to /a/sda1 , sda2 to /b/c/sda2 , or do they mount to the same
directory ?
As far as I can remember, only requirement is that the mount point (i.e. the directory) must already exist. Other than that, you can come up with any scheme that fits your needs. The fact that the filesystems are lay on same disk does not pose any limit.
After all, you could even move the filesystem later to a different medium and re-mount it. You would do it e.g. if the disk is failing or you want more space.
Regarding naming, it's rather question of why you need the filesystem in the first place. It's common to have a separate (large) filesystem just for user home directories. Natural place for home directories is /home so the trick is to mount that filesystem to this path. For servers it's often advantageous to separate /var this way. But if you just want a separate storage, you can always mount it to any unused path (eg. /finance), as long as the path is unique and meaningful for your users (I guess /sda1 would not be but YMMV ;)).
- [...] how can I create some virtual or temporary partition/filesystem
for testing and learning mounting and mountpoint ?
See Archemar's answer. (By the way it should work on any common GNU/Linux distribution, not just Fedora 22.)