# restore clonezilla image to virtualbox



## time4e (Oct 30, 2012)

I few months back I created a CloneZilla image of my FreeBSD 9 Intel based web server for a backup. I wanted to test pfsense and since the server in question had dual nics it was a perfect fit. So I reformatted the FreeBSD 9 server and installed PFSENSE. I now want to restore the clonezilla image of my FreeBSD web server to virtualbox. Can this be done without issue? is there Anything I should know before giving it a try? Any help or advice would be great. 


Thanks,
-Tim


----------



## wblock@ (Oct 30, 2012)

No problem.  The VM disk must be at least as large as the original.


----------



## time4e (Oct 31, 2012)

I knew it sounded to good to be true. Clonezilla reported it was able to successfully restore the image, after rebooting the VM; FreeBSD goes through the regular start up motions and just reboots it's self; I have tried a few times but it moves to quickly for me to see where in the boot process it's tripping over. Even when attempting to boot FreeBSD in safe mode and single user mode it does the same thing. Any suggestions?

Thanks,
-Tim


----------



## wblock@ (Oct 31, 2012)

When you created the VM, did you change any of the hardware defaults?  Changing the disk controller caused problems for me.  Also make sure that if the original system was 64-bit, the VM was created that way.  It has not worked for me to change an existing 32-bit VM to 64-bit.


----------



## time4e (Oct 31, 2012)

The only thing I changed was the Networking setting for the VM. I need it to use a bridged adapter rather than NAT. The original system was 32-bit. The VM HDD controller is an IDE should I try to re-image it using a sata controller? I have also tested it with both ich9 and piix3 chipsets, also tried enabling PAE/NX no luck  Any ideas?

Thanks,
-Tim


----------



## wblock@ (Oct 31, 2012)

It should be PIIX4.  Don't use PAE.


----------



## time4e (Nov 1, 2012)

I've created a new VM using a sata controller for the HDD, this time during boot it looks like it stalls for a moment when it's attempting to initialize 8 USB ports (which my server had) and than right before it reboots it looks like its reporting some failure with mounting the root file system. Does that make any sense?

Thanks,
-Tim


----------



## wblock@ (Nov 1, 2012)

The backup did not copy the hardware config.  FreeBSD, unlike Windows, does not statically support only what was installed when it was built.

I have not tested a VirtualBox emulated SATA controller lately (it did not work well last time), but would avoid that as a potential problem.

Try booting the VM with mfsBSD.  Then you should be able to mount and edit the restored backup filesystems.  Without knowing the problem, it's hard to say what to check.

This is one of the reasons binary backups are questionable.  You can't get to any of the data without restoring all of it, and it may have backed up binary data that a filesystem-level backup would have ignored or set to the right state.

Worst-case, use mfsBSD to mount the restored partitions, then back them up using dump(8), then erase the broken install's partition, install from scratch, and restore(8) the backup.  See Backup Options For FreeBSD for more detail.


----------



## time4e (Nov 1, 2012)

I managed to take this screen shot, hopefully it sheds some more light on the issue(s)

http://www.flickr.com/photos/time4e/8143479913/


----------



## wblock@ (Nov 1, 2012)

Error 19 means "device does not exist."  What devices are listed when ? is typed?


----------



## time4e (Nov 1, 2012)

Since I reconfigured VM with ide controller error 19 has not been displayed.
The very last thing I think it says before the reboot is root mount waiting for usbus0..
I will try to reproduce error 19 and get back to you. I will also try the MFSbsd, dump, and restore options you provided. Hopefully I will be able to dump the back up to a samba share. What's the best way for me to determine what partitions have /var and /usr from mfsbsd?


----------



## wblock@ (Nov 1, 2012)

Use file(1) on a partition to show the last place it was mounted:

```
# file -s /dev/ada0s1a
/dev/ada0s1a:  Unix Fast File system [v2] (little-endian) last mounted on /, ...
```


----------



## time4e (Nov 2, 2012)

Grrr From mfsbsd I'm unable to mount any partition and unable to run FSCK_FS. any more idea's?

http://www.flickr.com/photos/time4e/8146577047/in/photostream


----------



## wblock@ (Nov 2, 2012)

The p1 partition is for bootcode.  The first filesystem is usually p2.


----------



## time4e (Nov 4, 2012)

I have restored the clonezilla image to the original server hardware. I have learned that Clonezilla is not the correct way to migrate the installation to a VM, so what about using Duplicity?

Use FTP_PASSWORD=secret duplicity / ftp://backup@ftp.example.com/

If I followed the Duplicity instructions correctly the above command should give me a full system backup that I can than restore to a fresh FreeBSD install within Virtual BOX. Does this seem correct to everyone else? Also what would be the command to restore the backups to the fresh install?

Thanks,
-Tim


----------



## wblock@ (Nov 4, 2012)

If the filesystems are UFS, the correct way to back them up is with dump(8).  It is the only thing that understands everything that can happen with a UFS filesystem.  Backup Options For FreeBSD shows how to use it.  The easiest way to transfer one system to another is to do the backup, install a minimal FreeBSD system on the target, then restore the backup over it.

If the filesystems are ZFS, the analogous commands are zfs send and zfs receive.


----------



## time4e (Nov 9, 2012)

wblock@,
Will this also backup and restore all my installed ports, dependencies, and libs?

Thanks,
-Tim


----------



## wblock@ (Nov 9, 2012)

Yes.  Those are all contained in the filesystems.


----------



## time4e (Nov 11, 2012)

What about SQL databases?


----------



## wblock@ (Nov 11, 2012)

The only data not in a filesystem would be the partition tables and boot blocks.  The boot block is easily recreated, and the partition tables can be backed up in a usable form with gpart(8):
`% gpart backup ada0`


----------



## time4e (Nov 19, 2012)

In an effort to backup my file system using a windows share that I mounted to /mnt/bsdbackup

I executed the following

dump -C16 -b64 -0uanL -h0 -f /mnt/bsdbackup/root.dump / 

I periodically used control+t to check the status

load: 2.81  cmd: mksnap_ffs 76342 [running] 950.00r 0.00u 369.94s 100% 852k
load: 2.81  cmd: mksnap_ffs 76342 [running] 950.18r 0.00u 370.14s 100% 852k
load: 2.81  cmd: mksnap_ffs 76342 [running] 950.37r 0.00u 370.34s 100% 852k
load: 2.81  cmd: mksnap_ffs 76342 [running] 950.57r 0.00u 370.55s 100% 852k
load: 2.81  cmd: mksnap_ffs 76342 [running] 950.74r 0.00u 370.74s 100% 852k
load: 2.81  cmd: mksnap_ffs 76342 [running] 950.89r 0.00u 370.74s 100% 852k

after about 30 minutes I notice that nothing had been saved to the windows share, fearful that I used the command incorrectly and was backing up all data locally I could not cancel dump using control+c.

My questions

Am I doing something wrong?  
How would one cancel a dump?
Also I would much rather backup data to a remote ftp server, what is the dump command that would allow me to do so?


Thanks,
-Tim


----------



## wblock@ (Nov 19, 2012)

-L tells dump(8) to make a snapshot before starting.  The output from control-t is showing that snapshot being made.  The dump hasn't started yet.  Why the snapshot is taking so long... don't know.

Backing up to a remote FTP server would require FUSE.  I don't know how reliable it is on FreeBSD now.

SSH works reliably.  The document in post #8 shows examples.


----------

