I'm attempting to take an fstab that looks something like this:
and write a script to loop through the "# Added by KNOPPIX" entries, then cut c1-9 off the next line and run mount $whatever-I-just-detected /mountpoint and also write that mountpoint to a file.
How would I write the condition to find "# Added by KNOPPIX" and then get it to look at the next line, first 9 characters, basically how can I get sed/awk/whatever to read something like this line by line and not go to the next line until it did something?
-n tells sed print only requested lines
/^#/ search for lines starting with # and then execute the following commands
{N; read in next line
s/^#.*\n/ substitute the comment part by nothing
\(.........\) save the first nine characters in \1
.* substitute the rest by noting
/p} print the matched and substituted line.
well I hacked around last night and came up with this:
but it doesn't work, I have to give it a fs type, which is more difficult because I have to search for all the letters between the 2nd and 3rd blank spaces on the same line to populate a fs type variable, and I can't seem to figure out how to get grep/sed/awk to do that, ideas? If I can figure that out, then I have to write something that will only mount if that mountpoint is either ntfs, fat16 or fat32. I'm really starting to enjoy the power of bash scripts, though I'm still pretty new to it, it's amazing what you can do
Take a look at you fstab. The option "noauto" explicitly demands
_NOT_ to automount the device. If you want it to be mounted
automatically, change "noauto" to "auto".
Further take a look at
Your script cannot work due to the way mount uses the
fstab. If you call mount with a device listed in the fstab,
mount will mount it to the mount point specified in the fstab,
-- that's the use of the fstab -- not to a recently created
folder. So if you want the device mounted according to the fstab
extract the information from the fstab if not you have to give
the information needed on the command line.
The problem is I don't know how knoppix sets the drives to noauto, I've been trying to figure that out. Also, I don't want to mount non ntfs/fat16/fat32 drives, so I still need to detect the fs type and mount them with a script, unless I can figure out how knoppix does it.
My script works and mounts the drive if I specify -t ntfs, and it generates the mount point. I will try to look into the automount scripts, but until then I'm still trying to find out how to detect text on the next line beyond the comment, and between the 2nd and 3rd blank character.
When i export the directory where the data really is, i can specify which hosts can mount it. On the remote server i create a mount point directory and then mount it to the source servers directory (that has the data).
I need to run my script on Server X , i would login there and type in the... (11 Replies)
Hello experts,
On my RHEL box when i mount a nfs file system using autofs, the df -t shows the file system as nfs only. For which mounts does it report the filesystem as autofs. ?? I actually want to see the filesystem getting reported as autofs instead of nfs. Pls guide me
I... (1 Reply)
Hi friends
I'm a newbie trying to automount a nfs shared directory. Below is the configuration I'm using
FreeBSD machine as NFS server. IP Address - 192.168.1.60
# cat /etc/exports
/shared 192.168.1.50
Solaris 10 as NFS client. IP Address - 192.168.1.50
# cat... (1 Reply)
Folks;
I'm mounting a directory on a different SUSE 10 server from my SUSE server fine. using this mount command:
# mount 192.168.132.11:/var/local/new /var/local/new
this command above works fine but when i added a new line to my "/etc/fstab" to be mounted automatically every time i... (2 Replies)
Hello,
I have a SUN Solaris 9 machine (Sun-Fire-V490).
I put a DVD in the reader to install a software. The automount procedure did not work (vold is running) : I have nothing under /cdrom
When I try "eject" command I have the answer "No default media available"
When I try to mount manually the... (3 Replies)
My site has a few sun solaris server including out NIS server and NFS server on solaris machines. we also have few suse linux and redhat linux machine.
All our home directory is on our NFS server(sun Solaris) and this is automounted through /etc/auto_master and /etc/auto_home this worked fine... (1 Reply)
I install an external disk on my sun solaris 8
this went fine and I was able to access all filesystem on the disk. the new disk is mounted on /local
then 6 hours later
files under /local/files was 1 byte in size
at the same time I received the following
error message in... (4 Replies)