# Copying Debian installation to gpart partition



## balanga (Nov 5, 2017)

I have a multiboot gpt partitioned hard disk which uses a FreeBSD based grub and numerous bootable OSes many of which boot from an ISO image. 

I've just installed Debian on a separate disk and was interested in copying the installation to my multiboot disk. Since Debian boots via grub, I was wondering whether adding Debian to my multiboot disk would consist of adding an additional linux-data partition, adding the necessary grub entries and then copying the Debian partition to the linux-data partition.

If that sounds ok, then how do I copy that partition?  Do I do that from within Debian, or copy the the partition using dd or some utility such as Clonezilla or Partclone?


----------



## Phishfry (Nov 5, 2017)

When I moved an installation of Debian from one machine to another they store the nework config in a fixed file. So you must adjust the interface name manually. Not a big deal but coming from FreeBSD it took some poking to figure that out.
/etc/network/interfaces
On FreeBSD I have ifconfig_DEFAULT="DHCP" and that works much better.

Does FreeBSD use GRUB2? That is default on Debian stretch.


----------



## balanga (Nov 5, 2017)

Phishfry said:


> When I moved an installation of Debian from one machine to another they store the nework config in a fixed file. So you must adjust the interface name manually. Not a big deal but coming from FreeBSD it took some poking to figure that out.
> /etc/network/interfaces
> On FreeBSD I have ifconfig_DEFAULT="DHCP" and that works much better.
> 
> Does FreeBSD use GRUB2? That is default on Debian stretch.



I'm using FreeBSD's GRUB2 but am having difficulty adapting the Debian Grub entry to FreeBSD

```
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2cdf3ff8-2c16-4b59-a487-93c96d036765' {
    load_video
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_msdos
    insmod ext2
    set root='hd1,msdos2'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2  2cdf3ff8-2c16-4b59-a487-93c96d036765
    else
      search --no-floppy --fs-uuid --set=root 2cdf3ff8-2c16-4b59-a487-93c96d036765
    fi
    echo    'Loading Linux 4.9.0-4-amd64 ...'
    linux    /boot/vmlinuz-4.9.0-4-amd64 root=UUID=2cdf3ff8-2c16-4b59-a487-93c96d036765 ro  quiet
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-4.9.0-4-amd64
```

I know I need to change 'hd1,msdos2' to 'hd0,gpt14',  but 'part_msdos' needs changing and I've no idea about UUID.

fstab will also need changing...

```
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb2 during installation
UUID=2cdf3ff8-2c16-4b59-a487-93c96d036765 /               ext4    errors=remount-ro 0       1
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
```


----------

