特殊:Badtitle/NS100:MoveMountpointHowto
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/MoveMountpointHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/af | • {{#if: UbuntuHelp:MoveMountpointHowto|Afrikaans| [[::MoveMountpointHowto/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ar | • {{#if: UbuntuHelp:MoveMountpointHowto|العربية| [[::MoveMountpointHowto/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/az | • {{#if: UbuntuHelp:MoveMountpointHowto|azərbaycanca| [[::MoveMountpointHowto/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/bcc | • {{#if: UbuntuHelp:MoveMountpointHowto|جهلسری بلوچی| [[::MoveMountpointHowto/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/bg | • {{#if: UbuntuHelp:MoveMountpointHowto|български| [[::MoveMountpointHowto/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/br | • {{#if: UbuntuHelp:MoveMountpointHowto|brezhoneg| [[::MoveMountpointHowto/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ca | • {{#if: UbuntuHelp:MoveMountpointHowto|català| [[::MoveMountpointHowto/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/cs | • {{#if: UbuntuHelp:MoveMountpointHowto|čeština| [[::MoveMountpointHowto/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/de | • {{#if: UbuntuHelp:MoveMountpointHowto|Deutsch| [[::MoveMountpointHowto/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/el | • {{#if: UbuntuHelp:MoveMountpointHowto|Ελληνικά| [[::MoveMountpointHowto/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/es | • {{#if: UbuntuHelp:MoveMountpointHowto|español| [[::MoveMountpointHowto/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/fa | • {{#if: UbuntuHelp:MoveMountpointHowto|فارسی| [[::MoveMountpointHowto/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/fi | • {{#if: UbuntuHelp:MoveMountpointHowto|suomi| [[::MoveMountpointHowto/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/fr | • {{#if: UbuntuHelp:MoveMountpointHowto|français| [[::MoveMountpointHowto/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/gu | • {{#if: UbuntuHelp:MoveMountpointHowto|ગુજરાતી| [[::MoveMountpointHowto/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/he | • {{#if: UbuntuHelp:MoveMountpointHowto|עברית| [[::MoveMountpointHowto/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/hu | • {{#if: UbuntuHelp:MoveMountpointHowto|magyar| [[::MoveMountpointHowto/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/id | • {{#if: UbuntuHelp:MoveMountpointHowto|Bahasa Indonesia| [[::MoveMountpointHowto/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/it | • {{#if: UbuntuHelp:MoveMountpointHowto|italiano| [[::MoveMountpointHowto/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ja | • {{#if: UbuntuHelp:MoveMountpointHowto|日本語| [[::MoveMountpointHowto/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ko | • {{#if: UbuntuHelp:MoveMountpointHowto|한국어| [[::MoveMountpointHowto/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ksh | • {{#if: UbuntuHelp:MoveMountpointHowto|Ripoarisch| [[::MoveMountpointHowto/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/mr | • {{#if: UbuntuHelp:MoveMountpointHowto|मराठी| [[::MoveMountpointHowto/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ms | • {{#if: UbuntuHelp:MoveMountpointHowto|Bahasa Melayu| [[::MoveMountpointHowto/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/nl | • {{#if: UbuntuHelp:MoveMountpointHowto|Nederlands| [[::MoveMountpointHowto/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/no | • {{#if: UbuntuHelp:MoveMountpointHowto|norsk| [[::MoveMountpointHowto/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/oc | • {{#if: UbuntuHelp:MoveMountpointHowto|occitan| [[::MoveMountpointHowto/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/pl | • {{#if: UbuntuHelp:MoveMountpointHowto|polski| [[::MoveMountpointHowto/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/pt | • {{#if: UbuntuHelp:MoveMountpointHowto|português| [[::MoveMountpointHowto/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ro | • {{#if: UbuntuHelp:MoveMountpointHowto|română| [[::MoveMountpointHowto/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/ru | • {{#if: UbuntuHelp:MoveMountpointHowto|русский| [[::MoveMountpointHowto/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/si | • {{#if: UbuntuHelp:MoveMountpointHowto|සිංහල| [[::MoveMountpointHowto/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/sq | • {{#if: UbuntuHelp:MoveMountpointHowto|shqip| [[::MoveMountpointHowto/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/sr | • {{#if: UbuntuHelp:MoveMountpointHowto|српски / srpski| [[::MoveMountpointHowto/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/sv | • {{#if: UbuntuHelp:MoveMountpointHowto|svenska| [[::MoveMountpointHowto/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/th | • {{#if: UbuntuHelp:MoveMountpointHowto|ไทย| [[::MoveMountpointHowto/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/tr | • {{#if: UbuntuHelp:MoveMountpointHowto|Türkçe| [[::MoveMountpointHowto/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/vi | • {{#if: UbuntuHelp:MoveMountpointHowto|Tiếng Việt| [[::MoveMountpointHowto/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/yue | • {{#if: UbuntuHelp:MoveMountpointHowto|粵語| [[::MoveMountpointHowto/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/zh | • {{#if: UbuntuHelp:MoveMountpointHowto|中文| [[::MoveMountpointHowto/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/zh-hans | • {{#if: UbuntuHelp:MoveMountpointHowto|中文(简体)| [[::MoveMountpointHowto/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MoveMountpointHowto | UbuntuHelp:MoveMountpointHowto | {{#if: | :}}MoveMountpointHowto}}/zh-hant | • {{#if: UbuntuHelp:MoveMountpointHowto|中文(繁體)| [[::MoveMountpointHowto/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:MoveMountpointHowto|:MoveMountpointHowto|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :MoveMountpointHowto/zh | | {{#ifexist: MoveMountpointHowto/zh | | {{#ifeq: {{#titleparts:MoveMountpointHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:MoveMountpointHowto|1|-1|}} | zh | | }}
MoveMountpointHowto
Tonight I had the undesirable experience of spending hours trying to figure out why after I moved my mount point it would no longer automount on reboot! It turns out the answer is extremely simple if you know it and painfully hidden if you don't. It will take you longer to read this wiki than it will to fix the problem. Its easiest to do this from a terminal so if you're not there yet, start by opening a terminal window.
Now in my case I had created a partition ~+/dev/hda6+~ as mount point ~+/usr/local/mysql+~ because I was expecting a large database and wanted to be sure it had enough room devoted just to it. BUT it turns out that mysql likes its data in ~+/var/lib/mysql+~! *UGH* So I needed to move the mount point. This tutorial had not been written yet and is NOT covered in the mount man page so I spent hours trying to get my system to work properly. The only indication that anything was even wrong was when it kept saying "mounting local file system failed" at Boot Time. So if that happens to you after reading this wiki, then you've skipped a step or made a typo!
Anticipate this job to take 5-10 minutes from start to finish. More if you have to read this and do it at the same time.
First thing I needed to do is stop mysql and save my data! You can skip this part if you're just moving a regular mount point.
sudo /etc/init.d/mysql stop sudo mv /var/lib/mysql /var/lib/mysql_temp
ok, now lets take at look at ~+/etc/fstab+~
sudo nano -w /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/hda10 / ext3 defaults,errors=remount-ro 0 1 /dev/hda1 /boot ext3 defaults 0 2 /dev/hda5 /ftp ext3 noexec,user_xattr 0 2 /dev/hda7 /home ext3 defaults 0 2 /dev/hda9 /tmp ext3 defaults 0 2 /dev/hda12 /usr ext3 defaults 0 2 /dev/hda6 /usr/local/mysql ext3 defaults 0 2 /dev/hda13 /var ext3 defaults 0 2 /dev/hda11 /var/www ext3 defaults 0 2 /dev/hda2 /share ext3 defaults 0 2 /dev/hda8 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /etc/fstab (END)
Now while we're in here looking lets go ahead and make the changes we need to make.
move your cursor down to the line you want to change and make your change # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/hda10 / ext3 defaults,errors=remount-ro 0 1 /dev/hda1 /boot ext3 defaults 0 2 /dev/hda5 /ftp ext3 noexec,user_xattr 0 2 /dev/hda7 /home ext3 defaults 0 2 /dev/hda9 /tmp ext3 defaults 0 2 /dev/hda12 /usr ext3 defaults 0 2 /dev/hda6 /var/lib/mysql ext3 defaults 0 2 /dev/hda13 /var ext3 defaults 0 2 /dev/hda11 /var/www ext3 defaults 0 2 /dev/hda2 /share ext3 defaults 0 2 /dev/hda8 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /etc/fstab (END)
Now notice that /var/lib/mysql comes ~+BEFORE+~ "/var" This will never work! This is why I had so many problems. All the mount points in "/etc/fstab" must be in alphabetical order. "Trunk" first then "limbs". So lets fix that while we're here.
While your cusor is still on the line that you changed, hit ^k [CTRL]+K if your used to windows verbage. Then move down to where it should be and hit ^u [CTRL]+u. Now your work should look like this.... # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/hda10 / ext3 defaults,errors=remount-ro 0 1 /dev/hda1 /boot ext3 defaults 0 2 /dev/hda5 /ftp ext3 noexec,user_xattr 0 2 /dev/hda7 /home ext3 defaults 0 2 /dev/hda9 /tmp ext3 defaults 0 2 /dev/hda12 /usr ext3 defaults 0 2 /dev/hda13 /var ext3 defaults 0 2 /dev/hda6 /var/lib/mysql ext3 defaults 0 2 /dev/hda11 /var/www ext3 defaults 0 2 /dev/hda2 /share ext3 defaults 0 2 /dev/hda8 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /etc/fstab (END)
Notice "/dev/hda6" its now been moved to where it should live. a few more simple steps and we're done.
Now hit ^x or [CTRL]+x, followed by two [ENTER]'s to save your work.
That being done lets do the final steps..
sudo mkdir -p /var/lib/mysql sudo mount --move /usr/local/mysql /var/lib/mysql sudo cp -rp /var/lib/mysql_temp/ /var/lib/mysql/ sudo mount -a sudo /etc/init.d/mysql start sudo rm -rf /usr/local/mysql sudo rm -rf /var/lib/mysql_temp
That's it! You're done. Congratulations and enjoy your new mount point.