cannot write files to a mounted nfs partition

Posted on 2014-08-21
Last Modified: 2014-08-21
I mounted an nfs partition from a remote server to this host (thea). I wrote this line to /etc/fstab file and mounted with -a option. all things looks ok except when I tried to write file to this partition. it doesn't let me create file to this partition even with "root" permission, please help.  

[root@thea titanbackup]# touch testfile
touch: cannot touch `testfile': Permission denied

[root@thea mnt]# ls -alt
total 20
dr-xr-xr-x. 28 root root 4096 Aug 21 08:48 ..
drwxr-xr-x   2 root root    6 Jun 17 14:31 titanbackup
drwxr-xr-x.  6 root root 4096 Jun 14 21:07 .
drwxr-xr-x.  2 root root 4096 Feb 11  2014 hgfs
drwxr-xr-x.  2 root root 4096 Feb 10  2014 cdrom
drwxr-xr-x.  2 root root 4096 Feb  5  2014 ExternalHD
[root@thea mnt]#

[root@thea titanbackup]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg_OS-home on /home type ext4 (rw)
/dev/mapper/vg_OS-tmp on /tmp type ext4 (rw)
/dev/mapper/vg_Gentran-LogVol00 on /u1 type ext4 (rw)
/dev/mapper/vg_OS-usr on /usr type ext4 (rw)
/dev/mapper/vg_OS-var on /var type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) on /u1/nfsbackup type nfs (rw,vers=4,addr=,clientaddr= on /mnt/titanbackup type nfs (rw,vers=4,addr=,clientaddr=
[root@thea titanbackup]# cat /etc/*-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@thea titanbackup]#

root@thea titanbackup]# cat /etc/fstab

# /etc/fstab
# Created by anaconda on Mon Feb  3 23:20:58 2014
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
UUID=011240a7-1286-43ef-9e77-889eada1b760 /                       ext4    defaults        1 1
UUID=8678f3c4-d9a0-44fe-96ea-f292b022c84e /boot                   ext4    defaults        1 2
/dev/mapper/vg_OS-home  /home                   ext4    defaults        1 2
/dev/mapper/vg_OS-tmp   /tmp                    ext4    defaults        1 2
/dev/mapper/vg_Gentran-LogVol00 /u1                     ext4    defaults        1 2
/dev/mapper/vg_OS-usr   /usr                    ext4    defaults        1 2
/dev/mapper/vg_OS-var   /var                    ext4    defaults        1 2
UUID=969cf12d-482f-4b54-a6e0-79a8600509aa swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0   /u1/nfsbackup nfs     _netdev         0 0
titan:/u1/backup/thea/nfsbackup   /mnt/titanbackup nfs    _netdev         0 0
[root@thea titanbackup]#
Question by:Jason Yu
    LVL 34

    Accepted Solution

    on the titan server, what is the output of /etc/exports?
    for that export (titanbackup) does it have the option no_root_squash?
    if not, that is your problem since by default root over an nfs share will be like nobody
    adding no_root_squash to your export options will allow root access over nfs

    example: /u1/backup/thea/nfsbackup *(no_root_squash)
    you want to add that option there with whatever other options you already have

    Author Comment

    by:Jason Yu
    I just added the no_root_sqush to this titan server but it's still not working, could you check?

    [root@titan ~]# cat /etc/exports
    /u1/backup/jupiter    ,sync)
    /u1/backup/halo                 halobk(rw,sync)
    /u1/backup/ora9igl    ,sync)
    /u1/centos                      *(rw,sync)
    /u1/centos/centos-6_32          *(rw,sync)
    /u3/appsperi          ,sync),sync) elysium(rw,sync) phobos(rw,sync)
    /u1/centos/rhel64_5.5           *(rw,sync)
    /u2/backup/luna       ,sync)
    /u1/backup/thea       ,sync,no_root_squash)
    [root@titan ~]#

    [root@thea titanbackup]# mount titan:/u1/backup/thea/nfsbackup   /mnt/titanbackup
    mount.nfs: /mnt/titanbackup is busy or already mounted
    [root@thea titanbackup]# umount -f /u1/nfsbackup
    umount2: Invalid argument
    umount: /u1/nfsbackup: not mounted
    [root@thea titanbackup]# cd ..
    [root@thea mnt]# umount -f /mnt/titanbackup/
    [root@thea mnt]# mount -a
    [root@thea mnt]# cd titanbackup/
    [root@thea titanbackup]# touch test
    touch: cannot touch `test': Permission denied
    [root@thea titanbackup]#
    LVL 34

    Assisted Solution

    by:Seth Simmons
    after you change the exports file, you need to run exportfs -a on titan for the nfs server to refresh the export list
    remove the mount on thea and mount again
    the syntax you added in exports is correct

    Author Comment

    by:Jason Yu
    It's working now, wonderful job.

    [root@thea titanbackup]# touch test
    [root@thea titanbackup]# ls -alt
    total 4
    -rw-r--r--  1 root root    0 Aug 21  2014 test
    drwxr-xr-x  2 root root   17 Aug 21  2014 .
    drwxr-xr-x. 6 root root 4096 Jun 14 21:07 ..
    [root@thea titanbackup]# rm -rf test
    [root@thea titanbackup]#

    Author Comment

    by:Jason Yu
    what is exportfs command for? and option -a -r?

    Author Comment

    by:Jason Yu
    thanks, I figured it out by google. have a nice night.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
    If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now