{"id":891,"date":"2015-07-25T17:09:06","date_gmt":"2015-07-25T08:09:06","guid":{"rendered":"https:\/\/hack.gpl.jp\/?p=891"},"modified":"2015-07-25T17:09:06","modified_gmt":"2015-07-25T08:09:06","slug":"post-891","status":"publish","type":"post","link":"https:\/\/hack.gpl.jp\/2015\/07\/25\/post-891.html","title":{"rendered":"NFS Boot \u306b\u6210\u529f\u3057\u305f"},"content":{"rendered":"
\u3068\u308a\u3042\u3048\u305a\u3001NFS Boot \u306f\u672c\u5f53\u306b\u3067\u304d\u308b\u306e\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u7d50\u679c\u3001\u3067\u304d\u307e\u3057\u305f\u3002
\u5b9f\u969b\u3084\u3063\u3066\u307f\u308b\u3068\u3001\u3044\u308d\u3044\u308d\u3068\u306f\u307e\u308b\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u304a\u304a\u3080\u306d\u4ee5\u4e0b\u306e\u624b\u9806\u3002\u5fd8\u308c\u306a\u3044\u3046\u3061\u306b\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n
\u25bc\u74b0\u5883<\/p>\n
NFS Server\u30fb\u30fb\u30fb\u30fbosx 10.9.5<\/p>\n
Boot OS\u30fb\u30fb\u30fb\u30fb\u30fb 2015-05-05-raspbian-wheezy<\/p>\n
<\/p>\n
\u25bc\u64cd\u4f5c\u306e\u6d41\u308c<\/p>\n
\u30fbNFS \u30b5\u30fc\u30d0\u3067\u30b7\u30a7\u30a2\u3059\u308b\u7528\u610f<\/p>\n
\u30fbarm \u7528\u306e img \u306e\u30eb\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u3092 NFS \u3078\u30b3\u30d4\u30fc\uff08\u5927\u4f53\u306f\u7b2c\uff12\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306b\u3042\u308a\u3002Fedora \u3068\u306f3\u756a\u76ee\uff09<\/p>\n
\u30fbSDCard \u306e FAT\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e boot \u306e cmdline.txt \u3078 nfs boot \u3059\u308b\u8a2d\u5b9a\u3068\u3001IP \u306e\u8a2d\u5b9a<\/p>\n
<\/p>\n
\u25bcosx \u306e NFS Server \u5074<\/p>\n
NFS\u306e\u8a2d\u5b9a\u3092\u5165\u308c\u3066\u3001nfsd \u3092\u518d\u8d77\u52d5\u3002\u64cd\u4f5c\u306froot \u3067\u3084\u3063\u3066\u3044\u307e\u3059\u3002\u30aa\u30f3\u30e9\u30a4\u30f3\u30de\u30cb\u30e5\u30a2\u30eb\u306f\u3053\u3053\u3002<\/p>\n
\n—- \/etc\/exports
\/nfs\/fedora22 -rw -mapall=root:wheel -network 192.168.1.0 -mask 255.255.255.0<\/p>\n<\/blockquote>\nexports \u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308c\u3070nfsd \u304c\u8d77\u52d5\u3057\u307e\u3059\u304c\u3001\u624b\u52d5\u3067\u64cd\u4f5c\u3057\u305f\u3044\u5834\u5408\u306f<\/p>\n
\n# nfsd start | stop<\/p>\n<\/blockquote>\n
NFS \u3067\u63d0\u4f9b\u3057\u3066\u3044\u308b\u30d1\u30b9\u306e\u78ba\u8a8d\u3002<\/p>\n
\n# showmount -e localhost
Exports list on localhost:
\/nfs\/fedora22 192.168.1.0
::<\/p>\n<\/blockquote>\n\u6700\u521dfedora22 \u5165\u308c\u3088\u3046\u3068\u3057\u3066\u3001\u5931\u6557\u3057\u3066\u3001RASPIAN \u5165\u308c\u305f\u306e\u3067\u540d\u524d\u304c\u3042\u308c\u3067\u3059\u304c\u3002<\/p>\n
\u305d\u308c\u3067\u3001boot \u3057\u305f\u3044 img \u3092\u30b3\u30d4\u30fc\u3002\u4ee5\u4e0b\u306f\u3001centos6.x \u3067\u3001osx \u306e NFS \u3092\u30de\u30a6\u30f3\u30c8\u3057\u3066\u3001rsync \u3057\u3066\u3044\u307e\u3059\u3002centos6\u306f\u30d0\u30fc\u30c1\u30e3\u30eb\u30dc\u30c3\u30af\u30b9\u3067osx \u3092\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30bb\u30b0\u30e1\u30f3\u30c8\u306b\u3044\u307e\u3059\u3002<\/p>\n
\n[root@cent66 etc]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
::
hope.junkhack:\/exports nfs 466G 390G 76G 84% \/nfs
hope.junkhack:\/nfs\/fedora22 nfs 466G 390G 76G 84% \/mnt\/fedora22<\/p>\n<\/blockquote>\nhope.junkhack \u306f\u540d\u524d\u89e3\u6c7a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3042\u308a\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u3001fstab \u306f\u3053\u3093\u306a\u611f\u3058\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u3002<\/p>\n
\n—- \/etc\/fstab
::
hope.junkhack:\/exports \/nfs nfs defaults 0 0
hope.junkhack:\/nfs\/fedora22 \/mnt\/fedora22 nfs defaults 0 0<\/p>\n<\/blockquote>\n\u3067\u3001RASPIAN \u306e\u30a4\u30e1\u30fc\u30b8\u3092\u30de\u30a6\u30f3\u30c8\u3002<\/p>\n
\n[root@cent66 RASPBIAN]# kpartx -av 2015-05-05-raspbian-wheezy.img
add map loop0p1 (253:2): 0 114688 linear \/dev\/loop0 8192
add map loop0p2 (253:3): 0 6277120 linear \/dev\/loop0 122880<\/p>\n[root@cent66 RASPBIAN]# mount \/dev\/mapper\/loop0p2 \/mnt\/raspi\/ <\/p>\n
[root@cent66 RASPBIAN]# df -h
Filesystem Size Used Avail Use% Mounted on
::
hope.junkhack:\/exports 466G 388G 78G 84% \/nfs
hope.junkhack:\/nfs\/fedora22 466G 388G 78G 84% \/mnt\/fedora22
\/dev\/mapper\/loop0p2 3.0G 2.4G 451M 85% \/mnt\/raspi
[root@cent66 RASPBIAN]# <\/p>\n<\/blockquote>\n\u3067\u3001\u30b3\u30d4\u30fc\u3002<\/p>\n
\n[root@cent66 RASPBIAN]# rsync -av \/mnt\/raspi\/ \/mnt\/fedora22\/
sending incremental file list
.\/
bin\/
bin\/bash
bin\/bunzip2<\/p>\n::<\/p>\n
var\/spool\/cron\/crontabs\/
var\/spool\/rsyslog\/
var\/tmp\/ <\/p>\nsent 2304687346 bytes received 1293752 bytes 4274293.05 bytes\/sec
total size is 2299569061 speedup is 1.00
[root@cent66 RASPBIAN]# <\/p>\n<\/p>\n<\/blockquote>\n
\u3067\u3001NFS \u3067\u30d6\u30fc\u30c8\u3059\u308b\u3068\u304d\u306b fstab \u306e\u4e2d\u304c\u305d\u306e\u307e\u307e\u3060\u3068\u3001SD \u30ab\u30fc\u30c9\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092chroot \u3057\u3066\u3057\u307e\u3046\u306e\u3067\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3002<\/p>\n
\n[root@cent66 etc]# vim fstab<\/p>\n
proc \/proc proc defaults 0 0
\/dev\/mmcblk0p1 \/boot vfat defaults 0 2
#\/dev\/mmcblk0p2 \/ ext4 defaults,noatime 0 1<\/p>\n<\/blockquote>\nNFS\u5074\u306e\u30a4\u30e1\u30fc\u30b8\u5c55\u958b\u306f\u4ee5\u4e0a\u3067\u7d42\u308f\u308a\u3002<\/p>\n
<\/p>\n
\u25bcBoot \u3059\u308bcmdline.txt \u306e\u4e2d\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0<\/p>\n
\nroot=\/dev\/nfs rootfstype=nfs nfsroot=192.168.1.17:\/nfs\/fedora22,udp,vers=3,nolock ip=192.168.1.24:192.168.1.17:192.168.1.1:255.255.255.0:rpi:eth0:off<\/p>\n<\/blockquote>\n
nolock \u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5fc5\u8981\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u308c\u3067\u52d5\u3044\u3066\u306f\u3044\u307e\u3059\u3002IP\u306e\u3068\u3053\u308d\u306f\u4ee5\u4e0b\u306e\u66f8\u5f0f\u3002<\/p>\n
\nip=<raspberrypi_ip>:<nfs_server_ip>:<default_gateway>:<mask>:rpi:eth0:off<\/p>\n<\/blockquote>\n
\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u30d6\u30fc\u30c8\u30ed\u30b0\u306f\u3001<\/p>\n
[ 4.638898] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1<\/p>\n[ 4.674857] IP-Config: Complete:<\/p>\n
[ 4.680180] device=eth0, hwaddr=b8:27:eb:97:45:fb, ipaddr=192.168.1.24, mask=255.255.255.0, gw=192.168.1.1<\/p>\n
[ 4.694694] host=rpi, domain=, nis-domain=(none)<\/p>\n
[ 4.701878] bootserver=192.168.1.17, rootserver=192.168.1.17, rootpath=<\/p>\n
[ 4.719859] VFS: Mounted root (nfs filesystem) readonly on device 0:14.<\/p>\n
[ 4.729328] devtmpfs: mounted<\/p>\n
[ 4.735147] Freeing unused kernel memory: 400K (80786000 - 807ea000)<\/p>\n
[ 5.132474] random: nonblocking pool is initialized<\/p>\n
[ 6.228285] udevd[177]: starting version 175<\/p>\n
Raspbian GNU\/Linux 7 pi ttyAMA0<\/p>\n
pi login: <\/pre>\n<\/p>\n
\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n
NFS Boot \u3055\u305b\u305f\u3042\u3068\u3001uname \u3057\u305f\u3089\u3001<\/p>\n","protected":false},"excerpt":{"rendered":"
\u3068\u308a\u3042\u3048\u305a\u3001NFS Boot \u306f\u672c\u5f53\u306b\u3067\u304d\u308b\u306e\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u7d50\u679c\u3001\u3067\u304d\u307e\u3057\u305f\u3002 \u5b9f\u969b\u3084\u3063\u3066\u307f\u308b\u3068\u3001\u3044\u308d\u3044\u308d\u3068\u306f\u307e\u308b\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u304a\u304a\u3080\u306d\u4ee5\u4e0b\u306e\u624b\u9806\u3002\u5fd8\u308c\u306a\u3044\u3046\u3061\u306b\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059\u3002 \u25bc\u74b0\u5883 NFS Serve […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","footnotes":""},"categories":[47,62,69],"tags":[],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"JunkHack","author_link":"https:\/\/hack.gpl.jp\/author\/junkhack\/"},"uagb_comment_info":0,"uagb_excerpt":"\u3068\u308a\u3042\u3048\u305a\u3001NFS Boot \u306f\u672c\u5f53\u306b\u3067\u304d\u308b\u306e\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u7d50\u679c\u3001\u3067\u304d\u307e\u3057\u305f\u3002 \u5b9f\u969b\u3084\u3063\u3066\u307f\u308b\u3068\u3001\u3044\u308d\u3044\u308d…","_links":{"self":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/891"}],"collection":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/comments?post=891"}],"version-history":[{"count":0,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/posts\/891\/revisions"}],"wp:attachment":[{"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/media?parent=891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/categories?post=891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hack.gpl.jp\/wp-json\/wp\/v2\/tags?post=891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}