Script that runs before fstab
On CentOs7, if I have this line in /etc/fstab:
/dev/sda6 /mnt/tempdir ext4 default 0 0 But I may NOT have /mnt/tempdir yet. What script I can use to add command to create directory /mnt/tempdir such that init process runs it before init runs /etc/fstab via command mount -a? |
With fstab the patitions are mouted.
I think it is not possible to create a directory below /mnt before the lines in fstab are executed. You can create that directory manually from command line in run level 3 or 5. |
Normally, /mnt is on a permanent filesystem (as part of the root filesystem). Once the subdirectory is created, it will be available on the next boot - thus available before the mount operation gets done.
|
Indeed, once you have created that directory it will stay there. If you just need the boot to proceed regardless, you could use the "nofail" option.
Code:
/dev/sda6 /mnt/tempdir ext4 nofail 0 0 |
I thought using rc.local might be a solution using these commands:
Quote:
Quote:
chmod +x /etc/rc.d/rc.local I have also commented out mount command in /etc/fstab. But when I reboot I see these in /mnt/tempdir: Quote:
But notice I did not specify quota in rc.local. So why is aquota.user added auto-magically? What causes it? Addendum: But now I have another problem: Quote:
Quote:
Why am I not able to do quotacheck? Thank you. |
Look here , or here or here for Centos guide.
Seems you might need to enable quota in /etc/fstab first. |
Here is the "solution":
I added userquota to rc.local like so: Quote:
Quote:
Quote:
|
Quote:
Quote:
|
Quote:
I just boot up and look at /mnt.tempdir1, and aquota.user shows up. I also deleted tempdir1 before reboot! |
Maybe the /dev/sda5 was mounted some time ago, with quotas enabled?
I still do not understand why a simple entry in fstab plus one time a mkdir does not work for you. |
Quote:
I may have to delete and a retry.... Quote:
|
Quote:
I unmounted /mnt/tempdir, and deleted all directories in /mnt. I also commented out everything I did in /etc/rc.local Then created another partition, /dev/sda8, format it with ext4, and put it in /etc/fstab like so: /dev/sda5 /mnt/tempdir ext4 defaults 0 0 /dev/sda8 /mnt/temp ext4 default 0 0 Recall that /dev/sda5 is the partition that auto-magically has aquota.user when it is mounted to /mnt/tempdir. and now I reboot ...there is no aquota.user auto-magically create for /dev/sda8 in /mnt/temp: Quote:
Quote:
Below shows sda5 and sda8 are type ext4: Quote:
Quote:
Quote:
Recall that there is nothing in /etc/fstab or /etc/rc.local command line that cause the creation of quotas in /mnt/tempdir, so how do I prevent aquota.user from being created in case for /dev/sda5? |
All times are GMT -5. The time now is 10:41 PM. |