Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

All about bind mounts in Linux

by | Sep 19, 2021

Wondering how to use bind mounts in Linux? You are in luck! The Support Engineers at Bobcares are here to offer their expertise.

Bind mounts allow you to mount one path into another path. Read on to find out more about this advice by our in-house experts at Bobcares.

How to bind mounts in Linux

Bind mounts grants the users access to a directory by binding the directory to the same user’s home directory. Since Linux version 2.4.0 you can remount a section of the file hierarchy in another location with the command:

mount –bind olddir newdir

After this, the same file content is accessible in two different places. You can also choose to remount a single file.
Rather than mounting a device on a specific path, bind mounts grant you the ability to mount one path into another.

For instance, suppose you have a small /var and a huge /opt partition. In this case, you will require additional space for the growing log files.

Let’s see what the Support Team suggests in this scenario:
First, you need to shut down services responsible for writing to the log file. Then:

mv /var/log /opt/var_log
mkdir /var/log
mount -o bind /opt/var_log /var/log

This will be reflected when you run the mount command seen below:

# mount | grep var
/opt/var_log on /var/log type none (rw,bind)

By this point, you can restart the services stopped previously.
In case you want this to carry on across reboots, update the /etc/fstab also with bind mount.

# /etc/fstab
/opt/var_log              /var/log                 none    bind    0 0

This trick comes in handy until a long-term fix is in place.

Additional details about bind mounts in Linux

Bind mounts in Linux allow you to mount a previously-mounted system to a different location within the same file system. Additionally, bind mounts are used to restrict user access to specific parts of a website. This is done by replicating that website’s directory to the user’s home directory.
You can configure a bind mount with the command:

mount --bind /path/to/domain /path/to/home/directory

Run the following command to add a bind mount to the file system table:

/path/to/domain /path/to/home/directory none bind,nobootwait 0 0

In case the nobootwait is not present in the fstab entry, you will get a message like this:

Continue to wait; or Press S to skip mounting or M for manual recovery.

Adding nobodywait to the fstab configuration’s option section makes sure that the system boots even when the bind mount directory is removed from the system.

[Looking for a helping hand? We are at your service.]

Conclusion

In short, we learned all about bind mounts in Linux today. With our Support Team on your side, you have nothing to worry about.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF