Export a directory with NFS v4

Posted In Storage, System - By Tum. On Friday, September 26th, 2008 With 0 Comments

ความแตกต่างอย่างมากที่ NFS v4 กับ NFS version เก่า คือสามารถที่จะ export แบบ single directory ที่มีรูปแบบคล้ายๆกับ ftp หรือ web server ตัวอย่างเช่น export directory /shared และ client สามารถที่จะ mount /shared ได้ในรูปแบบ servername:/ เราสามารถที่จะแก้ไขไฟล์ที่ /etc/exports ได้ดังนี้

/shared *(rw,fsid=0,sync)

** การที่จะทำการ export แบบนี้ได้จะต้องเซ็ตให้มี option fsid=0 ด้วย และสามารถที่จะทำได้แค่ directory เดี่ยวเท่านั้น

จากนั้น restart service แล้วลองใช้คำสั่งด้านล่างที่เครื่องฝั่ง client

#mount -t nfs4 servername:/ /mnt/

ในการ export นี้ directory ภายใน /shared อย่างเช่น

/shared/data

/shared/home

client สามารถที่จะใช้งานได้เลยโดยไม่ต้องทำการ mount ใหม่อีกครั้ง แต่ถ้า subdirectory ภายใน /shared นั้นเป็นคนละ filesystem หรือคนละ partition เราจะต้องเพิ่ม option nohide ในไฟล์ /etc/exports เข้าไปด้วยเครื่อง client จึงจะเห็น subdirectory นั้นๆ ดังตัวอย่างข้างล่าง

/shared/data *(rw,nohide,sync)

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*