[ Solved ] Moving UBUNTU to a new hard drive (HD)
Posted: 23. Feb 2011, 05:54
Hello,
How I moved Ubuntu 10.10 moved to new virtual disk.
--- IN HOST OS ---
Example hdd.vdmk with a size of 16gb split into 2g files.
vboxmanage createhd --filename hdd --sizebyte 17179869184 --format vmdk --variant fixed,split2g
add to the your VBox VM as SATA0 and your old one as SATA1
boot your VM use F12 to select seccond HDD to boot.
Let Ubuntu boot as normal...
--- IN UBUNTU ---
sudo su
NOTE: My new hdd location as example: /dev/sda
fdisk /dev/sda
NOTE: make one partitions (os) make active
NOTE: make smaller partition (swap) make type 82 linux swap
NOTE: write changes.
mkfs -t ext4 /dev/sda1
mkswap /dev/sda2
Apt-get install grub2
NOTE: (new hdd location: /dev/sda)
grub-install /dev/sda
mkdir /mnt/sda
mount /dev/sda /mnt/sda
rsync -vd /proc /mnt/sda/proc
rsync -vd /sys /mnt/sda/sys
rsync -vd /dev /mnt/sda/dev
rsync -vd /tmp /mnt/sda/tmp
mount -t proc proc /mnt/sda/proc
mount -t sysfs sysfs /mnt/sda/sys
mount -t devtmpfs devtmpfs /mnt/sda/dev
rsync -avP / /mnt/sda --exclude /mnt /proc /sys /dev /tmp
update-grub2
--- IN CHROOT NEW HDD UBUNTU ---
chroot /mnt/hda
update-grub2
nano /etc/fstab
NOTE: Update your UUID to the new HDD UUID you have. You can use 'blkid' to obtain the new UUID.
reboot
hold shift boot from /dev/sda (new hdd at bottem of list)
Let Ubuntu boot as normal on new hdd ...
apt-get update
apt-get install grub2
grub-install /dev/sda
update-grub2
reboot
--- IN HOST OS ---
You can now remove the old HDD as start your vm on your new copy!
Running update-grub2 now will remove the old hdd if you would like to ...
Enjoy
Mr.Deek
My Other Posts:
How I moved Ubuntu 10.10 moved to new virtual disk.
--- IN HOST OS ---
Example hdd.vdmk with a size of 16gb split into 2g files.
vboxmanage createhd --filename hdd --sizebyte 17179869184 --format vmdk --variant fixed,split2g
add to the your VBox VM as SATA0 and your old one as SATA1
boot your VM use F12 to select seccond HDD to boot.
Let Ubuntu boot as normal...
--- IN UBUNTU ---
sudo su
NOTE: My new hdd location as example: /dev/sda
fdisk /dev/sda
NOTE: make one partitions (os) make active
NOTE: make smaller partition (swap) make type 82 linux swap
NOTE: write changes.
mkfs -t ext4 /dev/sda1
mkswap /dev/sda2
Apt-get install grub2
NOTE: (new hdd location: /dev/sda)
grub-install /dev/sda
mkdir /mnt/sda
mount /dev/sda /mnt/sda
rsync -vd /proc /mnt/sda/proc
rsync -vd /sys /mnt/sda/sys
rsync -vd /dev /mnt/sda/dev
rsync -vd /tmp /mnt/sda/tmp
mount -t proc proc /mnt/sda/proc
mount -t sysfs sysfs /mnt/sda/sys
mount -t devtmpfs devtmpfs /mnt/sda/dev
rsync -avP / /mnt/sda --exclude /mnt /proc /sys /dev /tmp
update-grub2
--- IN CHROOT NEW HDD UBUNTU ---
chroot /mnt/hda
update-grub2
nano /etc/fstab
NOTE: Update your UUID to the new HDD UUID you have. You can use 'blkid' to obtain the new UUID.
reboot
hold shift boot from /dev/sda (new hdd at bottem of list)
Let Ubuntu boot as normal on new hdd ...
apt-get update
apt-get install grub2
grub-install /dev/sda
update-grub2
reboot
--- IN HOST OS ---
You can now remove the old HDD as start your vm on your new copy!
Running update-grub2 now will remove the old hdd if you would like to ...
Enjoy
Mr.Deek
My Other Posts:
- [ Solved ] SIMPLE UBUNTU SERVER / CLIENT NETBOOT v10.10
http://forums.virtualbox.org/viewtopic.php?f=3&t=39474 - [ Solved ] Win VBOX 4.0.4 vboxmanage createhd split2g
http://forums.virtualbox.org/viewtopic.php?f=6&t=39250 - [ Solved ] Moving UBUNTU to a new hard drive (HD)
http://forums.virtualbox.org/viewtopic.php?f=3&t=39292