# "Invalid partition" after movig to ESX



## ccc (Oct 17, 2013)

Hi

I've moved FreeBSD 8.2 to ESX4.1 and now I'm getting this error:

```
Invalid partition
No /boot/loader
```
How to solve this?


----------



## fonz (Oct 17, 2013)

I hope someone can help you, but in the meantime here's the obligatory disclaimer: Topics about unsupported FreeBSD versions.


----------



## wblock@ (Oct 17, 2013)

Most likely just hardcoded device entries in /etc/fstab.  Moving a disk from one system to another, or even to a different controller port, can give a different device number.  So entries in fstab that were pointing to ad0 should now be referring to ad1.

Is the error in post #1 the only thing shown on the screen, or is there more before it?


----------



## SirDice (Oct 17, 2013)

Did you physically move the disk from one machine to the other? Or did you make a duplicate of the disk?


----------



## Erratus (Oct 17, 2013)

Was the disk setup on a MBR or GPT scheme?

Did you install a boot loader?

Does the new machine have UEFI enabled?


----------



## ccc (Oct 19, 2013)

I've done an Acronis image of a physical FreeBSD 8.2 and restored this image on ESX4.1, but the VM won't boot and I get this error above.


----------



## wblock@ (Oct 19, 2013)

Use labels: FreeBSD Labeled Filesystems.


----------



## ccc (Oct 19, 2013)

wblock@ said:
			
		

> Use labels: FreeBSD Labeled Filesystems.



I booted the VM using mfsBSD and here is the fdisk output:
	
	



```
Disk name:      da0                                    FDISK Partition Editor
DISK Geometry:  10443 cyls/255 heads/63 sectors = 167766795 sectors (81917MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0       2080       2079        -     12     unused        0
      2080   51199968   51202047    da0s1      8    freebsd      165
  51202048         32   51202079        -     12     unused        0
  51202080    4095968   55298047    da0s2      8    freebsd      165
  55298048         32   55298079        -     12     unused        0
  55298080    2047968   57346047    da0s3      8    freebsd      165
  57346048         32   57346079        -     12     unused        0
  57346080   20783072   78129151    da0s4      8    freebsd      165
  78129152   89643008  167772159        -     12     unused        0
The following commands are supported (in upper or lower case):

A = Use Entire Disk   G = set Drive Geometry   C = Create Slice
D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Expert m.
T = Change Type       U = Undo All Changes     W = Write Changes  Q = Finish


Use F1 or ? to get more help, arrow keys to select.
```
 I've mounted the root partition and changed /etc/fstab:
	
	



```
# cat fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/da0s1              none            swap    sw              0       0
/dev/da0s2              /               ufs     rw              1       1
/dev/da0s3              /tmp            ufs     rw              2       2
/dev/da0s4              /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
linproc                 /compat/linux/proc/  linprocfs  rw      0       0
```
 but it still won't boot.


----------



## wblock@ (Oct 19, 2013)

Please do not use sysinstall(8) or fdisk(8) any more.  The output of `gpart show` would be helpful.


----------



## ccc (Oct 19, 2013)

wblock@ said:
			
		

> Please do not use sysinstall(8) or fdisk(8) any more.  The output of `gpart show` would be helpful.



Here is the output:

```
root@mfsbsd:~ # gpart show
=>       63  167772097  da0  MBR  (80G)
         63       2017       - free -  (1M)
       2080   51199968    1  freebsd  (24G)
   51202048         32       - free -  (16k)
   51202080    4095968    2  freebsd  (2G)
   55298048         32       - free -  (16k)
   55298080    2047968    3  freebsd  (1G)
   57346048         32       - free -  (16k)
   57346080   20783072    4  freebsd  [active]  (9.9G)
   78129152   89643008       - free -  (42G)

=>      0  4095968  da0s2  BSD  (2G)
        0  4095504      2  freebsd-swap  (2G)
  4095504      464         - free -  (232k)

=>      0  2047968  da0s3  BSD  (1G)
        0  2047248      4  freebsd-ufs  (999M)
  2047248      720         - free -  (360k)

=>       0  20783072  da0s4  BSD  (9.9G)
         0  20781936      4  freebsd-ufs  (9.9G)
  20781936      1136         - free -  (568k)
```


----------



## wblock@ (Oct 19, 2013)

That's a strange and complicated setup.  MBR with bsdlabel(8) subpartitioning, but only one partition on each slice.  And the first slice has nothing on it.  Did you mean to use 24 GB for swap?  Why is slice 4 set active?

I strongly suggest installing a less complicated setup on the target machine.  See Disk Setup On FreeBSD for instructions on that, or just use a standard FreeBSD install CD.  Back up the original computer to files (see Backup Options For FreeBSD).  Boot the target computer with mfsBSD, mount each filesystem, and restore over it.


----------



## ccc (Oct 19, 2013)

Swap is only 2 GB. I've changed in /etc/fstab:
	
	



```
/dev/da0s2              none            swap    sw              0       0
/dev/da0s1              /               ufs     rw              1       1
/dev/da0s3              /tmp            ufs     rw              2       2
/dev/da0s4              /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
linproc                 /compat/linux/proc/  linprocfs  rw      0       0
```

BTW how to set /dev/da0s1 (root) as active partition using mfsBSD?


----------



## wblock@ (Oct 19, 2013)

That will still not work, because you have bsdlabel(8) subpartitions.  They are only making it more complicated, requiring the links to be /dev/da0s3a for /tmp, for example.

But you also have no /usr filesystem at all.

gpart(8) can set partitions active.  Please see that manual page or the disk setup article for examples.


----------



## ccc (Oct 20, 2013)

Using mfsBSD, I've done the following:
	
	



```
root@mfsbsd:/ # gpart bootcode -b /boot/mbr da0
bootcode written to da0root@mfsbsd:/ #  gpart set -a active -i 1 da0
active set on da0s1
root@mfsbsd:/ # gpart show
=>       63  167772097  da0  MBR  (80G)
         63       2017       - free -  (1M)
       2080   51199968   [B] 1[/B]  freebsd  [[B]active[/B]]  (24G)
   51202048         32       - free -  (16k)
   51202080    4095968    2  freebsd  (2G)
   55298048         32       - free -  (16k)
   55298080    2047968    3  freebsd  (1G)
   57346048         32       - free -  (16k)
   57346080   20783072    4  freebsd  (9.9G)
   78129152   89643008       - free -  (42G)

=>      0  2047968  da0s3  BSD  (1G)
        0  2047248      4  freebsd-ufs  (999M)
  2047248      720         - free -  (360k)

=>       0  20783072  da0s4  BSD  (9.9G)
         0  20781936      4  freebsd-ufs  (9.9G)
  20781936      1136         - free -  (568k)

=>      0  4095968  da0s2  BSD  (2G)
        0  4095504      2  freebsd-swap  (2G)
  4095504      464         - free -  (232k)
```
Now I can boot my FreeBSD without any errors and everything works well!


----------

