Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati
  • Differenze per "Hardware/DispositiviPartizioni/SpostareHomePartizioneSeparata"
Differenze tra le versioni 2 e 3
Versione 2 del 19/09/2010 17.10.41
Dimensione: 5630
Commento:
Versione 3 del 19/09/2010 17.16.26
Dimensione: 5595
Commento:
Le cancellazioni sono segnalate in questo modo. Le aggiunte sono segnalate in questo modo.
Linea 19: Linea 19:
== Titolo 2 ==
The Guide

== The Guide ==
Linea 24: Linea 24:
Setup Partitions == Setup Partitions ==
Linea 28: Linea 28:
Find the uuid of the Partition === Find the uuid of the Partition ===
Linea 32: Linea 32:
sudo blkid {{{sudo blkid }}}
{{{ }}}
Linea 36: Linea 37:
sudo vol_id -u <partition> {{{ sudo vol_id -u <partition>
Linea 40: Linea 41:
sudo vol_id -u /dev/sda3 {{{ sudo vol_id -u /dev/sda3
Linea 44: Linea 45:
Setup Fstab == Setup Fstab ==
Linea 54: Linea 55:
sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d) {{{ sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)
Linea 60: Linea 61:
# (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings) {{{ # (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings)
Linea 67: Linea 68:
sudo mkdir /media/home {{{ sudo mkdir /media/home
Linea 71: Linea 72:
sudo mount -a {{{ sudo mount -a
Linea 75: Linea 76:
sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/. {{{ sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/.
Linea 79: Linea 80:
Check Copying Worked === Check Copying Worked ===
Linea 83: Linea 84:
A Sneaky Safety Manoeuvre === A Sneaky Safety Manoeuvre ===
Linea 87: Linea 88:
cd / {{{ cd /
Linea 92: Linea 93:
cd / {{{ cd /
Linea 97: Linea 98:
Make the Switch == Make the Switch ==
Linea 101: Linea 102:
gksu gedit /etc/fstab {{{ gksu gedit /etc/fstab
Linea 105: Linea 106:
# (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings) {{{ # (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings)
Linea 110: Linea 111:
sudo mount -a {{{ sudo mount -a
Linea 114: Linea 115:
After a reboot === After a reboot ===
Linea 118: Linea 119:
Technical Notes and Resources == Technical Notes and Resources ==
Linea 125: Linea 126:
= Titolo 1 =
Linea 127: Linea 127:
Testo...

 0. Passo 1
 0. Passo 2
 0. Passo 3

== Titolo 2 ==

Testo...

= Ulteriori risorse =

 * Risorsa 1
 * Risorsa 2

BR Indice()

HomeSpostarePartizioneDedicata

Testo...

Titolo 1

Testo...

  1. Passo 1
  2. Passo 2
  3. Passo 3

The Guide

Setting up /home on a separate partition is beneficial because your settings, files, and desktop will be maintained if you upgrade, (re)install Ubuntu or another distro. This works because /home has a sub-folder for each user's settings and files which contain all the data & settings of that user. Also, fresh installs for linux typically like to wipe whatever partition they are being installed to so either the data & settings need to be backed-up elsewhere or else avoid the fuss each time by having /home on a different partition.

Setup Partitions

This is beyond the scope of this page. Try here if you need help. Memorize or write down the location of the partition, something like /sda3. Its been suggested to use either ext2, ext3 or ext4 rather than vfat or ntfs. Using vfat is not supported and may fail, since vfat does not support permissions. Ntfs has an advantage of being journalised, like ext3 & ext4 but it can also be read easily by Windows. It is a lot less stable than ext3 or ext4 so it is really a question of stability compared with easy access for Windows. If you don't dual-boot with Windows or have plenty of hard-drive space then staying with very much safer ext3 or 4 is the obvious choice.

Find the uuid of the Partition

The uuid reference to all partitions get to a command-line to try this

sudo blkid      

Alternatively, for some older releases of Ubuntu the "blkid" command might not work so this could be used instead

{{{ sudo vol_id -u <partition>

for example

{{{ sudo vol_id -u /dev/sda3

Now you just need to note down (copy&paste into a text-file) the uuid of the partition that you have set-up ready to be the new /home partition.

Setup Fstab

These commands should;

  1. Creates a backup of fstab. The "$(date +%Y-%m-%d)" at the end automatically (and quite cleverly) gives the file today's date backwards.
  2. Compares fstab with the new back-up just to be certain it's good.
    • Opens the standard text-editor (gedit) in Ubuntu to edit fstab. Note that Kubuntu uses "kate" & Xubuntu uses "mousepad" instead but you could use any text-editor you have installed if you prefer.

{{{ sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d) cmp /etc/fstab /etc/fstab.$(date +%Y-%m-%d) gksu gedit /etc/fstab

and add these lines into it

{{{ # (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings) UUID=???????? /media/home ext3 nodev,nosuid 0 2

Replace???????? with the UUID number of the intended /home partition.

The Fstab location will be a temporary one - we are to mount the temporary location and copy the existing home to it. (/media/home is assumed in the rest of the guide). If /media/home does not exist yet, then you should create it with the command:

{{{ sudo mkdir /media/home

Now, mount the partition with:

{{{ sudo mount -a

Copy /home to the New Partition

{{{ sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/.

The --exclude='/*/.gvfs' prevents rsync from complaining about not being able to copy .gvfs, but I believe it optional. Even if rsync complains, it will copy everything else anyway. (See here for discussion on this)

Check Copying Worked

The data in /home now exists in 2 places but we need to check that it looks about right. If it looks approximately the same then it is probably completely right.

A Sneaky Safety Manoeuvre

So you now have 2 copies of your /home folder. The new one on the new partition and the old one still in the same partition it was always in. The problem is how to delete the right one!! Since we are still using the old /home 'just' rename your current /home folder:

{{{ cd / sudo mv /home /old_home

Now re-create a new blank /home directory just in case it has all gone wrong!

{{{ cd / sudo mkdir -p /home/user

Now if things have gone wrong then the system will boot into what appears to be a fresh install with all your data missing. In fact, of course, there are still 2 copies of it all :)

Make the Switch

We now need to modify the fstab again to point to the new /home and mount it properly. So again on a command-line

{{{ gksu gedit /etc/fstab

and now edit the lines you added earlier to delete the /media part. This should make /media/home into /home as follows

{{{ # (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings) UUID=???????? /home ext3 nodev,nosuid 0 2

and finally, remount the partition with:

{{{ sudo mount -a

Does it all still look fine? Can you still access your files & folders from the "Places" menu? Reboot to ensure that currently running programs use the /home that is on the new partition.

After a reboot

If everything is working, great, you can delete /old_home. If things aren't working, you can undo by moving your /old_home back to /home, and delete the line you added to fstab.

Technical Notes and Resources

Rsync was chosen over cp and find|cpio because it seemed to maintain permissions.

http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/

http://ubuntuforums.org/showthread.php?t=46866


CategoryNuoviDocumenti