HomeSpostarePartizioneDedicata
I vantaggi di questa Guida
Questa guida è stata liberamente tradotta dall'inglese ( https://help.ubuntu.com/community/Partitioning/Home/Moving ) per permettere di avere ulteriori punti di riferimento rispetto alle diverse informazioni già esistenti. Le Guide della Comunità sono un modo particolarmente utile di aiutare diverse persone in uno stesso momento. Questa guida:
- Ambisce a mantenere in funzione il sistema e a proteggere i dati in modo sicuro.
- o Se il sistema dovesse spegnersi inaspettatamente, andare in ibernazione o dovesse accadere qualcosa d'altro durante l'esecuzione di questa procedura, sarebbe sufficiente ri-avviare il sistema e continuare a lavorare. Questa d'altra parte è l'ambizione di questa guida.
- Prepara Partizioni e fstab prima, modificando fstab solo alla fine.
- o Le persone provano ed acquisiscono familiarità con gli strumenti prima che ci sia un "disastro" finale, e questo è un altro vantaggio della guida. Altre guide usano comandi mount, dopodichè spostano la /home e modificano fstab. Tuttavia se dovessimo scompaginare fstab a quel punto cruciale, qualora ri-avviassimo il sistema avremmo perso traccia dei files /home! Definire fstab prima e usare "sudo mount -a" per montare la partizione permette di verificare se il fstab modificato funziona in modo sicuro a quel punto del procedimento.
- Usa rsync per spostare i files
- o Rsync è stato sviluppato per i backups di /home, e molto di più. E' in grado di mantenere le altre caratteristiche dei files come permessi, titolarità e ownership, and timestamps. Ci sono molte discussioni su quale sia il comando più opportuno per spostare i files/home, incluso quelle di un tempo in cui cp era considerato non adatto a questa funzione (apparentemente ometteva files?). Cp non era stato sviluppato come strumento potente per backup quanto invece la messa a punto di rsync. La soluzione perciò è stata quella di usare una combinazione di find e cpio (See section 8.3.5).
La Guida
Configurare una /home su una partizione separata e dedicata offre dei benefici perchè le vostre impostazioni, files e Scrivania saranno mantenuti anche se aggiornate, re-installate Ubuntu o andate incontro a qualche crash totale. Ciò può accadere perchè /home contiene le cartelle delle impostazioni e dei files di ciascun utente. Cioè tutti i suoi dati! Oltretutto, per sua impostazione una nuova installazione linux tende tipicamente a ripulire la partizione che è stata prescelta. Questo perciò implica un notevole trambusto per trovare e salvare altrove tutti i dati degli utenti. Fastidio che si può eviatre con una /home separata in una partizione dedicata.
Configurare le Partizioni
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.
Trovare l' uuid delle Partizioni
Il codice uuid di tutte le partizioni si ottiene con questo comando a terminale:
sudo blkid
A volte, per alcune versioni più vecchie di Ubuntu il comando "blkid" potrebbe non funzionare. In questi casi utilizzate invece:
sudo vol_id -u <partition>
per esempio
sudo vol_id -u /dev/sda3
Ora prendete nota (copia e incolla in un file di testo) dell'identificativo uuid della partizione che avete definito essere la nuova e futura partizione /home.
Configuare Fstab
Questi comandi dovranno:
- Creare un backup di fstab. Il "$(date +%Y-%m-%d)" alla fine automaticamente abbina la data odierna di salvataggio al file.
- Confrontare fstab con quello nuovo, giusto per essere tranquilli che vada bene.
- Aprire l'editor di testo standard (gedit) in Ubuntu per modificare fstab. Notate che invece, Kubuntu usa "kate" e Xubuntu usa "mousepad" ma voi potete usare l'editor di testo che preferite.
{{{ sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d) cmp /etc/fstab /etc/fstab.$(date +%Y-%m-%d) gksu gedit /etc/fstab }}}
e aggiungete all'interno queste linee di istruzioni
{{{ # (identifier) (location, eg sda5) (format, eg ext3 or ext4) (some settings) UUID=???????? /media/home ext3 nodev,nosuid 0 2 }}}
Sostituendo ???????? con il numero UUID della partizione /home pre-definita.
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). Se /media/home non esiste ancora, dovete crearla con il comando:
sudo mkdir /media/home
Ora, montate la partizione con:
sudo mount -a
Copiate /home nella nuova Partizione
sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/.
Il --exclude='/*/.gvfs' non permette a rsync di lamentarsi di non essere in grado di copiare .gvfs, ma credo sia opzionale. Anche se 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