I have a dedicated server with CentOS 4 on it. I want to put FreeBSD 7 on it, but I do not have console access nor physical access.
I was thinking of doing a generic install of FreeBSD on a local machine, making config tweaks such as setting up network cards etc, and then creating a disk image of the install. I would then write this image onto the server with netcat feeding dd. Only problem is, transferring 70G of data (the size of the disk) is not practical. I can't think of a good way to get around this while still being sure the system will boot FreeBSD properly when rebooted.
Of course, in order for this to work, I need to minimize reboots and try to do everything from the working Linux install. Has anyone pulled something like this off before? How did you do it?
If I were you, I'd first set up a testbed server to replicate your remote system, then try to convert it in-house where screwing up won't kill your system.
I don't know what you have available as options in terms of how your remote system is hosted. Ideally you'd be able to boot or get it to boot something like RIP Linux, a memory-hosted OS so that you could manipulate the hard disk without running anything off it. I think that unless you have a way to control what boots when, you're asking for trouble manipulating the system disk while still running the system.
You could try using gparted to shrink your partitions down and then create a new partition in the blank space, then install FreeBSD into that slice and do a "dual boot" into the other system. That might be feasible.
No matter what, though, I'd still try doing it all in-house with a testbed to ensure you can get it working before playing with your working server.
As others have mentioned, if your time and sanity are worth anything you should pay your provider a one-time support fee to install FreeBSD.
If you're really bent on doing this yourself and you have a separate swap or otherwise unused partition you can do this by writing a bootstrap image to the extra partition and telling grub to boot to it. The Depenguinator is supposed to be able to do this for you. I haven't used it myself but I've used the same method to remotely switch Linux distribtutions.
(You might also want to look at a provider like SoftLayer, which has dedicated servers with remote console access at a pretty decent price.)
Make the image, compress it, transfer it to the Linux server you wish to convert and , then install that image onto a second partition of that server. Then configure the boot loader to boot to the new partition. I don't think writing over the active parition is likely to go smoothly.
This is pretty crazy, I like it :-)
You first need to check with your hosting provider if they allow that. If they do, ask them if they can install for you.
Anyway, your idea can sure work, but it is too risky to do remotely without console access to the box... You will likely end up locking yourself out of it.
I think, you need to use zeroer program or something like that to reduce size of HDD image
You want to do this all remotely with no interaction at the physical server? My good man!
The only way I could think of to do this would be to create a ramdisk with your OS on it, preconfigured to work on the network at your datacenter. Once you reboot (and the ramdisk is running the show on your server), you could then conceivably perform your plan, as long as you:
Anyway, good luck in this project, but you might want to ask if it would be cheaper, considering the time involved, to just pay the datacenter the $20 or whatever to re-image your server with FreeBSD!
Easy option: if you have a hardware virtualisation capable processor, you could strip the CentOS install back to give yourself plenty of disc space, install kvm and create yourself a virtual FreeBSD system which is the only process running on the server. The performance hit wouldn't be too bad, and you end up just using your CentOS system as a complicated bootloader for your FreeBSD system.
Alternatively, shrink your filesystem using resize2fs, shrink the partition with cfdisk to give yourself some free disk, and create a new partition at the end. Then download you could still use kvm (or even qemu) and with the argument -hda=/dev/hda (i.e. tell kvm that it's allowed to write to your raw hard disc - careful now) and you can run the FreeBSD installer directly onto your new partition.
Finally you can try booting your new partition by fiddling grub from within CentOS, and use the "one-shot" option to hedge your bets. Assuming you can power cycle the system, then if it fails to boot, you only have to power cycle to reboot back into your reliable CentOS install.
A bit hairy but we've done similar things with Linux->Linux systems before.