USBFlashDrive

Copia integrale usbpen con dd

Capita di voler copiare integralmente una chiavetta usb su cui, per esempio, abbiamo installato una distribuzione GNU/Linux.

Per effettuare una copia integrale possiamo utilizzare il comando di sistema “dd”.

Per prima cosa inseriamo la chiavetta ed identifichiamola.

root@host:~# tail -n 15 /var/log/messages
[ 3460.142979] USB Mass Storage support registered.
[ 3461.140853] scsi 5:0:0:0: Direct-Access hp v165w 0.00 PQ: 0 ANSI: 2
[ 3461.208876] sd 5:0:0:0: Attached scsi generic sg2 type 0
[ 3461.210933] sd 5:0:0:0: [sdb] 15773696 512-byte logical blocks: (8.07 GB/7.52 GiB)
[ 3461.212340] sd 5:0:0:0: [sdb] Write Protect is off
[ 3461.212349] sd 5:0:0:0: [sdb] Mode Sense: 00 00 00 00
[ 3461.212932] sd 5:0:0:0: [sdb] Asking for cache data failed
[ 3461.212941] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[ 3461.215794] sd 5:0:0:0: [sdb] Asking for cache data failed
[ 3461.215802] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[ 3461.218178] sdb: sdb1 sdb2
[ 3461.231576] sd 5:0:0:0: [sdb] Asking for cache data failed
[ 3461.231586] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[ 3461.231594] sd 5:0:0:0: [sdb] Attached SCSI removable disk
[ 3461.604212] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)

 

la chiavetta è sul dispositivo sdb ed è da 8GB.

root@host:~# df -h
File system Dim. Usati Disp. Uso% Montato su
/dev/sda2 13G 4,2G 8,1G 35% /
udev 2,0G 4,0K 2,0G 1% /dev
tmpfs 793M 848K 792M 1% /run
none 5,0M 0 5,0M 0% /run/lock
none 2,0G 1,4M 2,0G 1% /run/shm
/dev/sda3 439G 12G 404G 3% /home
/dev/sdb2 6,8G 855M 5,9G 13% /media/eded68f1-c30a-4135-bba0-9e926964ad02

 

la chiavetta è montata, smontiamola:

root@host:/home# umount /media/eded68f1-c30a-4135-bba0-9e926964ad02/

 

adesso effettuiamo la lettura del dispositivo:

root@host:/home# dd if=/dev/sdb of=/home/immagine.dd bs=1M

 

e poi compattiamo il risultato:

root@host:/home# gzip /home/immagine.dd

 

adesso possiamo archiviare l’immagine.

se vogliamo ripristinare l’immagine su una nuova chiavetta procediamo come per la lettura (quindi identifichiamo la chiavetta e la smontiamo) e poi, sempre con il comando “dd” facciamo:

root@host:/home# gunzip immagine.dd.gz
root@host:/home# dd if=/home/immagine.dd of=/dev/sdb bs=1M

fatto

No comments yet.

Leave a Reply

You must be logged in to post a comment.