个人工具
登录
查看“UbuntuHelp:DDtoNFS”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:DDtoNFS”的源代码
来自Ubuntu中文
←
UbuntuHelp:DDtoNFS
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/DDtoNFS}} {{Languages|UbuntuHelp:DDtoNFS}} === How to dd to a NFS server === I bought a new hard drive for my laptop and just wanted to copy the old disk to the new one because I didn't feel like installing everything again. On a desktop box that's pretty easy, just put the new disk in together with the old one and use dd to copy it across. Most laptops can only take one disk so that won't work. I have a NFS server with enough space to hold the laptop disk but NFS won't allow root to write on a NFS mounted directory and dd won't work as a normal user. This is how I did it. Boot from the *ubuntu Live CD with the old disk in the laptop. If portmap is not installed the NFS mount will take a while. Just wait a bit or install it. To install portmap type <pre><nowiki> sudo aptitude install portmap </nowiki></pre> Mount the NFS directory to /mnt . <pre><nowiki> sudo mount 192.168.1.1:/home/username /mnt </nowiki></pre> Check the permissions on the NFS directory to make sure you can write to it <pre><nowiki> ls -l /mnt </nowiki></pre> It might show something like this <pre><nowiki> -rw-r--r-- 1 1000 1000 108 2007-09-07 01:35 myfile.txt </nowiki></pre> That means only the user with user id 1000 can write to the directory. The user id for the ubuntu user on the live CD is 999. So lets add a user with uid 1000 that can write to the NFS directory... <pre><nowiki> sudo adduser diskuser --uid 1000 </nowiki></pre> To see the uid of a user type <pre><nowiki> sudo cat /etc/passwd | grep diskuser </nowiki></pre> Now we have a user with write permission on the mounted NFS directory. The other problem is that to read from /dev/ you need to be root. Lets take a look at /dev/hda <pre><nowiki> sudo ls -l /dev/hda </nowiki></pre> That shows <pre><nowiki> brw-rw---- 1 root disk 3, 0 2007-10-08 20:21 /dev/hda </nowiki></pre> which means only user "root" and group "disk" can read from it. Sudo to the NFS directory won't work because sudo will dd as root. To fix this we have to add "diskuser" to the "disk" group like this <pre><nowiki> sudo adduser diskuser disk </nowiki></pre> Now we can dd as a normal user. Log on as the "diskuser" with <pre><nowiki> su diskuser </nowiki></pre> Then to copy the whole disk to a disk image on the NFS server type <pre><nowiki> dd if=/dev/hda of=/mnt/disk_image.img </nowiki></pre> When it is done it will go back to the prompt and you'll see <pre><nowiki> diskuser@ubuntu:~$ </nowiki></pre> Exit "diskuser" by typing <pre><nowiki> exit </nowiki></pre> Unmount the NFS directory <pre><nowiki> sudo umount /mnt </nowiki></pre> Shut down the laptop and put the new hard drive in. Boot from the *ubuntu Live CD and mount the NFS directory on /mnt as shown above. Now you have to copy the disk image back to the new hard drive. <pre><nowiki> sudo dd if=/mnt/disk_image.img of=/dev/hda </nowiki></pre> When it's done you'll have a copy of your old disk on the new one. Shutdown the laptop and boot from the hard drive. Please note that if the new disk is bigger than the old one you'll have to resize the partitions to be able to use all the space. The UUID of the disk might change as well. If that happens just boot from the *ubuntu Live CD again, mount the hard drive and edit the UUID's in /etc/fstab and /boot/grub/menu.list . To get the UUID of a partition or disk run <pre><nowiki> ls -l /dev/disk/by-uuid/ </nowiki></pre> I hope this will be helpful to someone. PS: Thanks to all the guys in #kubuntu for their help in understanding NFS permissions. Have fun! [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:DDtoNFS
。