Tag Info

Hot answers tagged

21

Here's another way to do locking in shell script that can prevent the race condition you describe above, where two jobs may both pass line 3. The noclobber option will work in ksh and bash. Don't use set noclobber because you shouldn't be scripting in csh/tcsh. ;) lockfile=/var/tmp/mylock if ( set -o noclobber; echo "$$" > "$lockfile") 2> ...


12

One way to delete files/direcories like this is by their inode-reference. To find the inodes for elements in current dir: ls -i 14813568 mikeaâcnt To delete this: find . -inum 14813568 -delete


11

If you use NFSv4 with sec=krb5p, then it is secure. (That means use Kerberos 5 for authentication, and encrypt the connection for privacy.) But if you use NFS v3 or NFS v4 with sys=system, then no, it's not secure at all. There might also be some concern with exposing the kerberos and rpc ports to the internet at large, just in case of unknown ...


9

I'm pretty sure that you are looking at legacy concerns. Recall that the Perl5 manual was released in 1994 and that it was just an edit of Perl4's manual from 1991. In those days it could probably be said about the oft-named Nightmare File System that "it isn't how well the bear dances that amazes, but that it dances at all". NFS2 in the 1991 epoch was ...


9

NFS was designed with the idea that user and group ids would be the same on all machines across the network. For ordinary users, that works ok. But root's UID is always 0, and just because you have root on one box, it doesn't mean that you should have root access to every machine on the network. Therefore, NFS treats root specially. By default, root is ...


9

Mount the NFS-share on the clients using the mount-options "bg,intr,hard". Most important in your case is "bg" for background - which tells the system not to block when the server is not available. "intr" for interrruptable - so you can kill hanging mounts on the client with the kill command. "hard" is the opposite of "soft". The difference is that "hard" ...


9

Normally when mounting NFS it's a good idea to have flags set similar to this: bg,intr,soft bg If the first NFS mount attempt times out, retry the mount in the background. After a mount operation is backgrounded, all subsequent mounts on the same NFS server will be backgrounded immediately, without first ...


8

Olaf Kirch originally developed both the user space and kernel based version of the NFS server. In his year 2000 book, "Linux Network Administration" he says: The 2.2.0 kernel supports an experimental kernel-based NFS server developed by Olaf Kirch and further developed by H.J. Lu, G. Allan Morris, and Trond Myklebust. The kernel-based NFS support provides ...


8

unfs3 is dead as far as I know; Ganesha is the most active userspace NFS server project right now, though it is not completely mature. Although it serves different protocols, Samba is an example of a successful file server that operates in userspace. I haven't seen a recent performance comparison. Some other issues: Ordinary applications look files up ...


8

The reason you limit the number of inodes a user can access is so they don't make the system as a whole run out of inodes by creating a huge number of 0-byte files. With most Linux file systems (e.g. ext3 and ext4), each file (including device files) or directory has an inode -- a number used to point to a given file/directory. If a system runs out of ...


8

The following excerpt from this essay potentially explains why that directory refuses to be deleted: NFSv4 requires that all filenames be exchanged using UTF-8 over the wire. The NFSv4 specification, RFC 3530, says that filenames should be UTF-8 encoded in section 1.4.3: “In a slight departure, file and directory names are encoded with UTF-8 to deal with ...


7

NFS itself is not generally considered secure - using the kerberos option as @matt suggests is one option, but your best bet if you have to use NFS is to use a secure VPN and run NFS over that - this way you at least protect the insecure filesystem from the Internet - ofcourse if someone breaches your VPN you're effectively wide open, but that would be the ...


7

Remember that each of the NFS client systems will determine the username by looking up the numerical UID in /etc/passwd, or your centralized user database. The NFS server only stores the UID in numerical format, and does not know about usernames. This is also true for group names vs. GIDs. In your case, serverA and serverB must have different usernames ...


7

No. You can export a device file through NFS or some other network filesystems. But the meaning of the device file is dependent on the machine where you open it. If you export /dev/video0 over NFS from a server machine to a client machine, the client machine just sees “character device 81:0”, and interprets it as its own video capture device. The client ...


7

I prefer to use hard links. lockfile=/var/lock/mylock tmpfile=${lockfile}.$$ echo $$ > $tmpfile if ln $tmpfile $lockfile 2>&-; then echo locked else echo locked by $(<$lockfile) rm $tmpfile exit fi trap "rm ${tmpfile} ${lockfile}" 0 1 2 3 15 # do what you need to Hard links are atomic over NFS and for the most part, mkdir is ...


7

The quick way The quickest way to transfer files over a LAN is likely not rsync, unless there are few changes. rsync spends a fair bit of time doing checksums, calculating differences, etc. If you know that you're going to be transferring most of the data anyway, just do something like this: user@dest:/target$ nc -q 1 -l -p 1234 | tar xv ...


7

The disk quota is a limit on the disk space that a user can occupy. It has nothing to do with free space on disk. Look at the manual page for quota(1). So when trying to sync (write out data held in memory destined to files on disk) it finds that you aren't allowed to write that much data. And BTW, there is no "space in folders" in Unix/Linux. A directory ...


7

You should not use non-ASCII characters in the command line since as you could see, for some reason, they won't necessarily correspond to the filename (Unicode has various ways for expressing accented letters). Something like: rm -rf mike* should work since the filename is directly generated by the shell. But make sure there's only one match (do an echo ...


6

Bad form, I know, to answer my own question, but.... I needed a couple more steps, outlined here. In short, I needed to execute: sudo nfsd update As another detail, I added the client name to the export and removed the "-rw" flag.


6

I understand that mkdir is atomic, so perhaps: lockdir=/var/tmp/myapp if mkdir $lockdir; then # this is a new instance, store the pid echo $$ > $lockdir/PID else echo Job is already running, pid $(<$lockdir/PID) >&2 exit 6 fi # then set traps to cleanup upon script termination # ref http://www.shelldorado.com/goodcoding/tempfiles.html ...


6

Check these items, and see if any work for you: On the client, if you're not already using the cto option in the options column of the /etc/fstab line for your NFS filesystem, add it. cto tells the nfs client to open files via close-to-open, which makes them refresh the file whenever they open it. On the server, make sure your filesystem is exported with ...


6

You tagged this under /nfs.. If that file is on an NFS filesystem, you might need to export it on the server with no_root_squash to allow root on the clients to change the permissions on the file system.


6

My question is, if I purchase a standard Windows external hard drive with a USB connection, will I be able to copy the files from the Linux cluster's files server to the external drive? Yes, there is no technical problem to this, however: The hardware us not a "standard windows hard drive with USB connection". Please scrap the windows part from that ...


6

So if I'm reading your question correctly you're doing: $ cp /nfs/mnt/foo.tar.gz /local/ext3/drive and the system crashes. I'd try isolating: $ cat /nfs/mnt/foo.tar.gz > /dev/null to check if it is the NFS system, and then $ dd if=/dev/zero of=/local/ext3/drive/zeros bs=1K count=8000 to check writes to the local file system. If both of those come ...


6

I would never outright remove init.d scripting.....What I would do is de-install the package that you no longer need. The init.d file should be removed as a result of the package removal. Package removal meets your need of simplification and possibly removal of some needed disk space.


5

For account management, use LDAP. Simply install an LDAP client on all clients (e.g. the ldap-auth-client package on Ubuntu) and run an LDAP server on the server. Keep the home directories over NFS or Samba. The simplest setup is to mount the home filesystem as a whole on all clients at boot time. This doesn't provide good security because anyone who plugs ...


5

As Noufal Ibrahim says, I think this is a Solaris convention. IIRC, /export/home is used on the server where the actual files live, and /home is where the other servers mount it. What does mount | grep home say? I'm guessing that /export/home has a file system type of UFS, and /home has a type of NFS? /etc/fstab may also have some clues.


5

by default NFS is enabled you can remove packages: apt-get --purge remove nfs-kernel-server nfs-common portmap or stop services temporary: /etc/init.d/portmap stop /etc/init.d/nfs-kernel-server stop or stop them permanently: service portmap stop service nfs-kernel-server stop


5

The reasons are largely historical and pragmatic and date back to the technology that was incumbent in the 1980s and 1990s when much of the work on distributed systems architecture was being done: NFS is an open standard and is supported on pretty much every unix system built from the late 1980s onwards. Unix and NFS were the incumbent standard in the ...


5

Quoting verbatim from https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=123962105 : Under linux/unix, if you remove a file that a currently running process still has open, the file isn't really removed. Once the process closes the file, the OS then removes the file handle and frees up the disk blocks. This process is complicated ...



Only top voted, non community-wiki answers of a minimum length are eligible