I created a mount point in an existing setup with this command:
mount -o loop /comptel
and made an entry to /etc/fstab as well which looks like this:
#tmpfs /comptel tmpfs defaults,loop,size=110,mode=1777,dev,exec,suid 0 0
tmpfs /comptel tmpfs rw,nosuid,nodev,size=110,noatime,user,uid=1000,gid=1001,mode=1777 0 0
This looks in df -kh like this:
tmpfs 4.0K 0 4.0K 0% /comptel
But when i reboot the setup, contents from /comptel gets deleted.
Can someone please help me with this issue? What am i doing wrong here?
You could be making a typo or some mistake in /etc/fstab
Steps to mount a disk permanently.
Doing this will mount your disk during boot time.
Attach your disk manually once.
Goto /proc/mounts or /etc/mtab and look for your mount entry.
Copy the entry that you want to be mounted on boot.
Paste it at the end of /etc/fstab. /etc/fstab Contains entries that are mounted during boot.
You can even manually add your entry in /etc/fstab, but copying it from /proc/mounts or /etc/mtab makes sure that you not make any error or mistake in listing your mount point
more helpful links link 1 link 2
Related
I am writing an initramfs, executed in busybox, in which I mount a partition using those commands:
/bin/busybox mount -n -t proc proc /proc
mount -n -t devtmpfs devtmpfs /dev
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs inittemp /mnt
mkdir /mnt/saved
mount -n -t "${rootfstype}" -o "${rootflags}" ${device} /mnt/saved
But when the system starts up, I have this error:
mount: mounting /dev/mmcblk0p2 on /mnt/saved failed: No such file or directory
I know that when the device is not found, there is a message like Device does not exist, so I think the problem is coming from the directory /mnt/saved that is not correctly created yet.
I tried adding an ls -l /mnt after the mkdir to check that the directory is correctly created, but most of the time, if I do so, the error disappears. So I though the problem might be synchronization problem (of the tmpfs, weird!) So I tried some other things like creating a dummy file in the directory to force a kind of synchronisation. This works, but is a dirty workaround and I want to find the real cause of the problem to build a clean solution.
By the time I was writing my question, I finally found the solution by myself… I post it anyway just in case somebody is stuck like me.
Actually, the mount command of busybox does not show a message about device, if it cannot find it, but always show No such file or directory.
My problem was actually coming from the root device which was not ready yet, and so not in the /dev directory yet. In order to make it work correctly, I simply added this line before the mount:
while ${rootwait} && ! [ -b "${device}" ]; do sleep 1; done
I have the following in my /etc/fstab file:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
sv-01:/mnt/UEF/home/user/Videos/complete /home/user/Videos nfs defaults,noauto,user 0 0
and when I issue the command sudo mount -a -v, I get the following output
mount: proc already mounted on /proc
mount: /dev/mmcblk0p1 already mounted on /boot
nothing was mounted
but when I copy paste the above segment of code and issue the below command, the folder mounts perfectly.
sudo mount sv-01:/mnt/UEF/home/user/Videos/complete /home/user/Videos
What could possibly be causing this?
You specified "noauto" parameter for sv-01:/mnt/UEF/home/user/Videos/complete.
From mount manual:
mount -a [-t type] [-O optlist]
(usually given in a bootscript) causes all filesystems mentioned in
fstab (of the proper type and/or having or not having the proper
options) to be mounted as indicated, except for those whose line
contains the noauto keyword. Adding the -F option will make mount
fork, so that the filesystems are mounted simultaneously.
I have 2 drives connected to the server both are 500GB.
drive 1 =/dev/sdc
drive 2 =/dev/sdb
I've partitioned the second drive /dev/sdb in 2 partitions having /dev/sdb1 & /dev/sdb2
What I was looking for is to mount 2 drives on one directory which is /home.
So I did this mount function
mount -l /dev/sdb /mnt/sdb
mount -l /dev/sdc1 /mnt/sdc1
mount -l /dev/sdc2 /backup
then mhddfs /mnt/sdb,/mnt/sdc1 /home -o allow_other
So 2 partitions are mounted to /home
And added this to /etc/ftab
/dev/sdb /mnt/sdb ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1
/dev/sdc1 /mnt/sdc1 ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1
/dev/sdc2 /backup ext4 usrjquota=quota.user,jqfmt=vfsv0 1 1
mhddfs#/mnt/sdb,/mnt/sdc1 /home fuse logfile=/var/log/mhddfs.log defaults,allow_other 0 0
My problem
first of all when reboot server the mhddfs is not automounted so I need to run the command manually through ssh "mhddfs /mnt/sdb,/mnt/sdc1 /home -o allow_other"
And sometimes when huge files are uploaded to /home directory it gets disconnected give this error message "`/home': Transport endpoint is not connected" so I have to umount and remount /home to resolve the problem.
Can you help me know what's wrong with my steps and what to do to resolve both problems.
I had the same issue. I wanted to extend my /home folder on my server by adding a second drive and chose to use mhddfs. I already had a whole harddrive entirely dedicated to my /home, the system being hosted on a separate drive - this has made things easier.
Here is how I proceeded, after my new harddisk was set up and formated:
I created two new mount points: /mnt/home1 and /mnt/home2
I edited /etc/fstab file to :
change my older harddisk moint point from /home to /mnt/home1
Set up my new harddisk mount point on /mnt/home2
Told mhddfs to merge /mnt/home1 and /mnt/home2 into /home
Here is the result in my etc/fstab:
UUID=f29aa9e5-5988-4603-9ecd-5c24dd804d94 /mnt/home1 ext4 defaults 0 2
UUID=e535c3fc-0842-4557-be85-55277912a058 /mnt/home2 ext4 defaults 0 2
mhddfs#/mnt/home1,/mnt/home2 /home fuse defaults,allow_other 0 0
Of course, you have to follow all these steps without restarting the machine (otherwise you will have no more /home directory).
It works pretty well. My older harddrive is now almost 100% full and my system began to write on the newer one, but practicaly speaking you don't even notice it. Everthing you see is a "normal" /home folder and mhddfs coordinates this in a totally transparent way.
I have tried with forcing fsck disk check on startup to make sure everything was ok - I set up the last parameter for mhddfs on /etc/fstab to "0" to make sure fsck does not create problem. Everything runs well, it seems pretty stable.
I need to create a chroot jail for my program. The program needs the contents of /dev to execute properly. I don't want to copy the contents of /dev in the chroot jail, because I want to avoid the duplication of elements in the jail.
I have found 2 solutions to this problem, but none of them are fully solving my problem:
Mounting /dev: works, but a sys admin can delete /dev if he deletes the chroot jail through "rm -rf". This is bad...
Symbolic link on /dev: does not work because symbolic links that are pointing outside of the jail do not work.
Do you know a solution that avoids duplication, is secure on deletion and works?
On linux :
You can mount devfs filesystem :
mount -t devtmpfs none /jail/dev
On freebsd :
You can mount devfs filesystem :
mount -t devfs none /jail/dev
Or for mount a folder (not recommended for dev) :
mount_nullfs /dev /jail/dev
If you want no duplication, you need to umount before delete the jail.
You can mount in readonly, but you can have problems with softwares (depends of jail use).
When i execute the df command i can see that tmpfs is mounted on /. What i need is to create a directory in /etc, say tmp and then mount another tmpfs on /etc/tmp. Can i do it by adding another entry in /etc/fstab saying tmpfs should be mounted on /etc/tmp.
Yes, for example (in /etc/fstab)
tmpfs /etc/tmp tmpfs defaults,size=50% 0 0