Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MIGRAZIONE Trasferire l'installazione su altro disco[SOLVED]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
LAj
Apprentice
Apprentice


Joined: 22 May 2004
Posts: 294
Location: Avellino[Italy]

PostPosted: Tue Nov 23, 2004 1:32 am    Post subject: MIGRAZIONE Trasferire l'installazione su altro disco[SOLVED] Reply with quote

Sto sostituendo l'hard-disk che avevo con uno più capiente.
Come posso fare a trasferire l'istallazione da una parte all'altra?
con le espressioni regolari?

Qualcuno ha qualche esperienza/link?

Grazie
_________________
They produce notes of any size as their own properties askng interests also.This is seignorage and goes to privates banks(FED, BCE).You don't have to pay to use $$,you can simply use your notes recovering monetary sovereignty.Public debt is not right!


Last edited by LAj on Sat Dec 11, 2004 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
comio
Advocate
Advocate


Joined: 03 Jul 2003
Posts: 2191
Location: Taranto

PostPosted: Tue Nov 23, 2004 7:29 am    Post subject: Reply with quote

Il metodo più pratico che mi viene è

partire con il live cd
montare il disco di partenza
montare il disco di destinazione
fare copia con cp -a partenza destinazione

Poi mettere in ordine il booter (grub o lilo che sia), ed il file /etc/fstab.

Dovrebbe bastare questo!

ciao
_________________
RTFM!!!!

e

http://www.comio.it
:)
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31447
Location: here

PostPosted: Tue Nov 23, 2004 8:00 am    Post subject: Reply with quote

Prova a cercare sul forum italiano ci sono diversi post al riguardo
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Tue Nov 23, 2004 11:02 am    Post subject: Reply with quote

comio wrote:
Il metodo più pratico che mi viene è

partire con il live cd
montare il disco di partenza
montare il disco di destinazione
fare copia con cp -a partenza destinazione
[CUT]


Magari mettendoci anche un -p per presevare i permessi :wink:
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
hardskinone
Guru
Guru


Joined: 02 Jan 2004
Posts: 460

PostPosted: Tue Nov 23, 2004 11:14 am    Post subject: Reply with quote

gutter wrote:
Magari mettendoci anche un -p per presevare i permessi :wink:


Dal man:
Code:
-a, --archive
              Preserve  as much as possible of the structure and attributes of the original files in the copy (but do not pre-
              serve directory structure).  Equivalent to -dpPR.

_________________
Playlinux.net
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Tue Nov 23, 2004 11:21 am    Post subject: Reply with quote

Chiedo scusa umilmente e mi cospargo il capo di cenere :wink:
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
SteelRage
Apprentice
Apprentice


Joined: 17 Nov 2003
Posts: 192

PostPosted: Tue Nov 23, 2004 1:19 pm    Post subject: Reply with quote

questo è uno script che avevo trovato in giro per il forum qualche tempo fa...
ti darei il link esatto, come giusto... ma non lo trovo
quindi ti passo direttamente lo script, che famo prima:

Code:
#!/bin/bash
# This script will clone the root partition of your gentoo system to a selected
# partition and create the appropriate fstab file for the cloned partition

#################################################################################

# Change these variables according to your prefs, for CLONE_DIR always use a path
# like /dir1/dir2, never something like /dir or /dir1/dir2/dir3...
# CLONE_DIR either have to be defined in /etc/fstab, or mounted...
# BIND_DIR is a directory to mount - bind your root partition (it is needed for your
# gentoo system which uses devfs - otherwise /dev will not be correctly copied...
# If you do not want to change the fstab file for your cloned partition, set
# FSTAB_FLAG to 0...

BIND_DIR=/mnt/oldroot
CLONE_DIR=/mnt/clone
FSTAB_FLAG=1

#################################################################################
# Do not change these:
SOURCE_DIR=/   
CREATE_BIND_DIR=0
MOUNT_CLONE_DIR=0

###################### Subroutines ##############################################
#_____________________________________________________________________________
Check_params()

# Checks whether your destination partition is mounted or exist in /etc/fstab
# and checks for the need to create mount points
{
   SOURCE_PART=`grep "$SOURCE_DIR\ " /etc/mtab | awk  '{ print $1 }'`
   grep "$CLONE_DIR\ " /etc/mtab &> /dev/null
   if [ $? -ne 0 ]
      then
         grep "^[\ \t]*.*$CLONE_DIR\ " /etc/fstab &> /dev/null
         if [ $? -ne 0 ]
         then
            echo
            echo $CLONE_DIR is not listed in /etc/fstab as a valid mount point. Please either
            echo list it in your fstab, so it can be automatically mounted, or mount a partition
            echo on it !
            echo
            Usage
            exit 1
         else
            CLONED_PART=`grep "^[\ \t]*.*$CLONE_DIR" /etc/fstab | awk  '{ print $1 }'`
            if [ ! -d $CLONE_DIR ]
               then
                  mkdir $CLONE_DIR
            fi   
            MOUNT_CLONE_DIR=1
         fi
      else CLONED_PART=`grep "$CLONE_DIR" /etc/mtab | awk  '{ print $1 }'`
   fi
   if [ ! -d $BIND_DIR ]
      then
         CREATE_BIND_DIR=1
   fi   
}
#_____________________________________________________________________________
Usage() # Prints some help
{
   echo
   echo "############## gent-clone help #####################"
   echo
   echo "This script will clone your gentoo root partition to "
   echo "another partition. Usage:"
   echo
   echo "gent-clone mode [destination mount point]"
   echo
   echo 'where mode = "-c"  Clones current root partition to a destination partition'
   echo '           = "-p"  Prentend cloning; useful to see what would happen without any changes'
   echo '           = "-h"  Prints this message...'
   echo
   echo 'Destination mount point should be given as /dir1/dir2 or /dir format, if it is not supplied, '
   echo 'then the program uses internal defaults (can be changed at the beginning of the script).'
   echo 'A partition should be attached to the destination directory or the mount point  listed in'
   echo '/etc/fstab before using the script! '
   echo
   echo 'Normally, the /etc/fstab file on your root partition will be edited by the script:'
   echo 'A new adjusted /etc/fstab is created and copied over - this contains your destination'
   echo 'partition mounted as root. If you do not want this behavior, set the FSTAB_FLAG variable'
   echo 'from 1 to 0 by editing the first part of this script.'
   echo
   echo
   echo 'examples: gent-clone -c /mnt/clone - clone you root partititon to the partition mounted on /mnt/clone '
   echo '        : gent-clone -c            - clone your current root partition to your predefinied'
   echo '                                     partition (set this up by editing the first part of the script)'
   echo '        : gent-clone -p            - Pretend mode: Prints out what will happen when you issue a -c
argument'
}


#_______________________________________________________________________
Config() # Create /etc/fstab for cloned partition
{
cp /etc/fstab /etc/fstab.cloned

SLICE_CLONED=`echo $CLONED_PART | cut -d "/" -f3`   
SLICE_SOURCE=`echo $SOURCE_PART | cut -d "/" -f3`   

SED_FROM='^[\ \t]*\/dev\/'$SLICE_CLONED
SED_TO='\/dev\/clonepart'
cat /etc/fstab.cloned | sed -e "s/$SED_FROM/$SED_TO/" > /etc/fstab.cloned

SED_FROM='^[\ \t]*\/dev\/'$SLICE_SOURCE
SED_TO='\/dev\/rootpart'
cat /etc/fstab.cloned | sed -e "s/$SED_FROM/$SED_TO/" > /etc/fstab.cloned

SED_FROM='^\/dev\/clonepart'
SED_TO='\/dev\/'$SLICE_SOURCE
cat /etc/fstab.cloned | sed -e "s/$SED_FROM/$SED_TO/" > /etc/fstab.cloned

SED_FROM='^\/dev\/rootpart'
SED_TO='\/dev\/'$SLICE_CLONED
cat /etc/fstab.cloned | sed -e "s/$SED_FROM/$SED_TO/" > /etc/fstab.cloned
cp /etc/fstab.cloned $CLONE_DIR/etc/fstab

}
#_________________________________________________________________________
Clone() # Copies $SOURCE_PART to CLONED_PART
{
      if [ $CREATE_BIND_DIR -eq "1" ]
      then
         mkdir $BIND_DIR
      fi
      if [ $MOUNT_CLONE_DIR -eq "1" ]
      then
         mount $CLONE_DIR
      fi
      mount --bind $SOURCE_DIR $BIND_DIR
      rm -rf $CLONE_DIR/*
      cd $BIND_DIR
      find -mount -print | cpio -pdm $CLONE_DIR
      if [ $FSTAB_FLAG -eq "1" ]
      then
         Config
      fi
      echo
      echo "All done. Partition $SOURCE_PART was cloned to partition $CLONED_PART."
}
#____________________________________________________
Report() # What will happen; Used in pretend mode...
{
      echo

      if [ $CREATE_BIND_DIR -eq "1" ]
      then
         echo Creating $BIND_DIR...
      fi

      if [ $MOUNT_CLONE_DIR -eq "1" ]
      then
         echo Mounting $CLONED_PART on $CLONE_DIR...
      fi

      echo 'Mounting '$SOURCE_DIR' ('$SOURCE_PART') with -bind on '$BIND_DIR'...'
      echo 'Deleting all files in '$CLONE_DIR' ('$CLONED_PART')...'
      echo 'Changing dir to '$BIND_DIR'...'
      echo 'Copying everything in '$BIND_DIR' ('$SOURCE_PART') to '$CLONE_DIR' ('$CLONED_PART')...'
      echo

      if [ $FSTAB_FLAG -eq "1" ]
      then
         echo "Creating and copying a modified fstab, where $CLONED_PART is mounted as / ..."
      fi
}

######################### Main Program Module ##################################
case "$#" in
0)   
   Usage
   exit 1
   ;;
1)
   case "$1" in
   -p)
      Check_params
      Report
      exit 0
      ;;
   -c)
      Check_params
      Clone
      exit 0
      ;;
   -h)
      Usage
      exit 0
      ;;
   *)
      echo
      echo "Unknown parameter..."
      echo
      Usage
      exit 1
      ;;
   esac
   ;;
2)
   case "$1" in
   -p)
      CLONE_DIR=$2
      Check_params
      Report
      exit 0
      ;;
   -c)
      CLONE_DIR=$2
      Check_params
      Clone
      exit 0
      ;;
   -h)
      echo
      echo 'The "-h" parameter cannot be used with additional arguments...'
      echo
      Usage
      exit 1
      ;;
   *)
      echo
      echo "Unknown parameter..."
      echo
      Usage
      exit 1
      ;;
   esac
   ;;
*)
   echo
   echo 'This 2 is the maximum number of params!'
   echo
   Usage
   exit 1
   ;;
esac

############### End #####################################


questo invece è il copia-incolla del post:
Dear Gentooers,

Often times there are upgrades or changes which can potentially render you nicely configured system unsusable. If
this disaster happened, it is a very good feeling to have the EXACT copy of your original root partition backed up
and ready to use! I wrote a bash script which will clone your gentoo partition on another partition, so you are safe
to do anything advetureous...

Why is the script? Isn't "cp -a / /mnt/clone" would be enough? Unfortunately, this would require to unmount separate
partitions, like /home, and could cause problems with /dev partition which gentoo uses. Certain special files would
also be left out. So, after a reading a long discussion on gentoo user list, I chosen the possibly safest solution
(at least what I tried) and wrote a scrip around it to make it easy to use.

I have two (same sized) partitions for gentoo root. I also have /home on a separate partiton and I have one separate
partition containing /usr/local (symlinked), /opt (symlinked), /var/tmp/portage (PORTAGE_TMPDIR set in make.conf),
/usr/portage/distfiles (DISTDIR set in make.conf). Before I do something dangerous, I run the script to duplicate my
root partition, and with this setup I leave out some bulky stuff (copying your distfiles) which normally is not
changed that much.
The script has a "pretend mode", so you can see what will happen without any danger...


Here is the help taken from the script (you can also display it with "gent-clone -h")
"############## gent-clone help #####################"

This script will clone your gentoo root partition to "
another partition. Usage:"
gent-clone mode [destination mount point]"

where mode = "-c" Clones current root partition to a destination partition'
"-p" Prentend cloning; useful to see what would happen without any changes'
"-h" Prints this message...'
'Destination mount point should be given as /dir1/dir2 or /dir format, if it is not supplied, then the program uses
internal defaults (can be changed at the beginning of the script). A partition should be attached to the destination
directory or the mount point listed in /etc/fstab before using the script! Normally, the /etc/fstab file on your
root partition will be edited by the script: A new adjusted /etc/fstab is created and copied over - this contains
your destination partition mounted as root. If you do not want this behavior, set the FSTAB_FLAG variable from 1 to
0 by editing the first part of this script.

Examples:

gent-clone -c /mnt/clone
-->clone you root partititon to the partition mounted on /mnt/clone '
gent-clone -c
-->clone your current root partition to your predefinied'
partition (set this up by editing the first part of the script)
gent-clone -p
--> Pretend mode: Prints out what will happen when you issue a -c argument'

I call this file as gent-clone. Copy it to an empty file and save it.
I hope someone finds this helpful, I certainly used it regularly...

Cheers: Viktor

[/code]
_________________
In the end we only see to change light to dark dark to light light to dark dark to light.
Back to top
View user's profile Send private message
markgreene
n00b
n00b


Joined: 04 Oct 2004
Posts: 31
Location: Catania, Italy

PostPosted: Tue Nov 23, 2004 1:53 pm    Post subject: Reply with quote

ho 'trapiantato' con successo il mio vecchio hd su un nuovo 40G, ed ho seguito lo stesso metodo descritto da comio:

Code:
# mount /dev/hdd2 /mnt/vecchio
# mount /dev/hdb5 /mnt/nuovo
# cp -a /mnt/vecchio/* /mnt/nuovo

did the trick ;)

nel mio caso ho anche dovuto apportare le (ovvie) modifiche a:
/boot/grub/grub.conf
/etc/fstab

e tutto ha funzionato senza problemi :)

HTH
_________________
What part of /sbin/ifconfig eth0|grep 'inet'|awk -F' ' '{print $2}'|sed -e s/addr:// dont you understand?
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31447
Location: here

PostPosted: Tue Nov 23, 2004 2:05 pm    Post subject: Reply with quote

Ottimo allora metti il tag [risolto] al titolo
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
LAj
Apprentice
Apprentice


Joined: 22 May 2004
Posts: 294
Location: Avellino[Italy]

PostPosted: Sat Dec 11, 2004 11:36 am    Post subject: Reply with quote

Provo il metodo di mark!

Ma intanto mi studio lo script(a la faccia dello zio BILL ...e scusate se è poco) che sicuramente è una cosa seria!
_________________
They produce notes of any size as their own properties askng interests also.This is seignorage and goes to privates banks(FED, BCE).You don't have to pay to use $$,you can simply use your notes recovering monetary sovereignty.Public debt is not right!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum