Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Lets say in partition exist a file system and in a folder is mounted another file system... this means I have one partition, in other words every files system Not requires separate partition for it??? Correct
Not sure what you are "exactly" expecting. But here's how it works:
Let us say you have a hard disk on a PC with three partitions on it. The layout is
sda (first hard disk drive)
|-- sda1
|-- sda2
|-- sda3
If your OS is found on sda1, then it will be mounted at / by default. Then, inside your Linux filesystem, you can have mount points anywhere. A mount point is simply a directory which you can use to mount drives/filesystems, e.g. mounting sda3 at /mnt/hdisk:
Code:
mkdir -p /mnt/hdisk (creating the mount point)
mount -t FILESYSTEM_TYPE /dev/sda3 /mnt/hdisk/
Now, let us say you want to mount sda2 at a mount point under /mnt/hdisk/... Yes, you can. You simply make sure the mount point exists and you mount sda2 there.
e.g.
Code:
mkdir -p /mnt/hdisk/mnt2/hdisk (creating the mount point)
mount -t FILESYSTEM_TYPE /dev/sda2 /mnt/hdisk/mnt2/hdisk/
And now, let's say you plug in a pendrive. You will see that the /dev/sdb drive will be activated and you will probably have a FAT partition sdb1 under it. Basically, the drive/disk is sdb and the filesystem(s) under it, in this case there is only one, is sdb1.
Then you decide to mount sdb1 under the mounted sda2's filesystem:
Code:
mkdir -p /mnt/hdisk/mnt2/hdisk/mnt3/usbdrive (creating the mount point)
mount -t FILESYSTEM_TYPE /dev/sdb1 /mnt/hdisk/mnt2/hdisk/mnt3/usbdrive/
Finally, you see that you have drives and then partitions on them. Note that each partition is treated like a different filesystem which you can mount at a given mount point. That's all.
Last edited by aragorn2101; 01-18-2017 at 02:56 AM.
If I understood your question well: different filesystems (located on different partitions) can be mounted on the same filesystem, using different directories, but these are only the mount points, not the filesystems themselves. Every partition may contain (hold) only one filesystem.
and you can also mount the same filesystem several times into different directories.
Creates and uses a 1GB file that contains the swap filesystem. Much the same as a mount would be except without mkfs, and mount. If you're concerned about wear you can systematically create new swap files and leave the old one(s) to occupy the worn space, but change the configuration to not use them. Of course a filesystem on a filesystem will be slower than a raw device.
So in other words mounting a file system in a dir/dir1/
And dir2/dir3 can accessed same files from two points?
A partition holds ONLY one file system but this file system can have mount points?
I think you are asking is can you do the following....
Code:
# mount | grep /dev/mapper
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/centos-tmp on /tmp type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/centos-var on /var type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
# mkdir /mnt/var
# mount /dev/mapper/centos-var /mnt/var
# mount | grep /dev/mapper
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/centos-tmp on /tmp type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/centos-var on /var type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/mapper/centos-var on /mnt/var type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
# echo "test" > /var/log/test.log
# cat /mnt/var/log/test.log
test
Correct? If so... then yes you can.
In regards to a partition, a partition generally can only hold one filing system however LVM and logical volumes make this a little bit more complicated tho. As LVM itself can store multiple logical volumes within a single partition (or spanned across multiple partitions). As you'll note above, what I have actually mounted it a logical volume as opposed to a partition. Here we have several volumes stored in one partition as such:
To clarify: LVM (Logical Volume Management) – which I strongly recommend using – separates the physical storage picture (what disks there are, how big, where, partitions, etc. etc.) from the logical one (what the operating system's users see).
Physical volumes are used to create "storage pools." LVM itself decides how data is distributed among the volumes in the pool, but the data is distributed. This can be used to seamlessly achieve things like load-balancing and RAID. It's also great for those ... "click, click!" ... sounds ... that disk drives sometimes begin to make.
The space created by these "storage pools" is then distributed among "logical volumes." And you can simply paint the picture that you want, without regard to partitions, disks, and so on.
You can make changes on the fly without rebooting the system.
Quote:
LVM: Don't Leave Home Without It.™
Last edited by sundialsvcs; 02-22-2017 at 08:58 AM.
Lets say in partition exist a file system (directory structure) and in a folder (directory) is mounted another file system(a sub-directory )... this means I have one partition.
in other words every files system (directory structure with sub-directories) Not requires separate partition for it??? Correct
Correct, you do not have to split up your directory structure in Linux in order to use it, but it does have the ability to do so if one wants to.
But it will only use the root directories for each partition.
I'll leave it at that for now.
but the key word bind for your fstab is something you can look into when you get frisky for learning about splitting up directory structures and there sub-directories.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.