Skip to content

Instantly share code, notes, and snippets.

@skorotkiewicz
Created December 8, 2016 15:09
Show Gist options
  • Save skorotkiewicz/37573dce57caf0d4cf561b216a974f8e to your computer and use it in GitHub Desktop.
Save skorotkiewicz/37573dce57caf0d4cf561b216a974f8e to your computer and use it in GitHub Desktop.
Clone OpenSuse VirtualBox vm
Tested with OpenSuse 11.3
Before cloning, you will need to change some hdd stuff in fstab & menu.lst. Let's begin:
1) Start the vm to clone and login as root.
2) Get the info from your partitions:
opensuse11:~ # fdisk -l
Disco /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ed24a
Disposit. Inicio Comienzo Fin Bloques Id Sistema
/dev/sda1 1 95 761856 82 Linux swap / Solaris
La partición 1 no termina en un límite de cilindro.
/dev/sda2 * 95 1045 7625728 83 Linux
====
so we got here that:
SWAP: /dev/sda1
/ : /dev/sda2
3) Edit /etc/fstab and change the way we choose the dev, as OpenSuse uses the id of the hdds and we need to use the name.
opensuse11:~ # cat /etc/fstab
/dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part1 swap swap defaults 0 0
/dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part2 / ext4 acl,user_xattr 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
As you see, swap partition is: /dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part1, so this will be our /dev/sda1
And /dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part2 will be /dev/sda2
Finally our fstab is like this:
opensuse11:~ # cat /etc/fstab
/dev/sda1 swap swap defaults 0 0
/dev/sda2 / ext4 acl,user_xattr 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
4) Now, we need to change grub options to boot system, edit /boot/grub/menu.lst and do the same, change the way you select the disk drives:
opensuse11:~ # cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Thu Jul 25 10:04:57 CEST 2013
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader
default 0
timeout 8
gfxmenu (hd0,1)/boot/message
##YaST - activate
###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.3 - 2.6.34-12
root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-default root=/dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part2 imagen=ontsi resume=/dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part1 splash=silent quiet showopts
initrd /boot/initrd-2.6.34-12-default
###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.3 - 2.6.34-12
root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-default root=/dev/disk/by-id/ata-VBOX_HARDDISK_VB874fb2ed-0a6c812d-part2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe
initrd /boot/initrd-2.6.34-12-default
=======
Once changed, your config file will be like this:
opensuse11:~ # cat /boot/grub/menu.lst
# Modified by YaST2. Last modification on Thu Jul 25 10:04:57 CEST 2013
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader
default 0
timeout 8
gfxmenu (hd0,1)/boot/message
##YaST - activate
###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.3 - 2.6.34-12
root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-default root=/dev/sda2 imagen=ontsi resume=/dev/sda1 splash=silent quiet showopts
initrd /boot/initrd-2.6.34-12-default
###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.3 - 2.6.34-12
root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-default root=/dev/sda2 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe
initrd /boot/initrd-2.6.34-12-default
5) Reboot the vm, check that everything is ok and you're done. Now you can clone the vm without problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment