changing the postion of a partion in fdisk

John Nielsen john at
Tue Jan 8 07:04:20 PST 2008

Quoting "Aryeh M. Friedman" <aryeh.friedman at>:
> I have my FreeBSD partition as partition 1 and my ntfs as partition 2
> but Vista insists that there is no suitable partion to install to
> (even though the ntfs partition is big enough)... after some research
> I found that vista absolutely insists that the ntfs partition be
> partition 1... how do I swap them and/or delete the ntfs one and
> renumber it so freebsd is in partion slot 2 (with nothing in 1 and
> then I can use fdisk to make a new slot 1)

You can probably just use FreeBSD's fdisk to swap them. Something along 
the lines of:

1) Verify your backups
2) Boot from a FreeBSD Rescue CD and enter the "fixit" shell
3) Type "fdisk /dev/yourdisk". I'll assume ad0 from this point.
4) Write down the output. All of it. Keep a copy in a safe place (this 
is actually good practice even if you're _not_ intentionally messing 
with your partitions). If you're feeling clever and/or lazy you could 
of course bring up a line printer or a network interface and print the 
output or copy it to another machine (from which you should then print 
it), but a file on the local disk will not serve (and a file on the 
mfsroot will go away as soon as you reboot or if anything unexpected 
happens, which it usually does).
5) Type "fdisk -u /dev/ad0" (or whatever your disk is). Manually enter 
the numbers (including explicitly setting the start/end sector, etc) 
for partition 2 as partition 1 and vice versa. Think about which 
partition you want to mark as active (probably 2, see step 10) and do 
so. Verify your changes against your printout, then commit them.
6) Type "ls /dev/ad0*" and verify that you see the devices you expect 
(including your FreeBSD partitions, probably something like ad0s2[a-d]).
7) Mount your root partition, e.g. "mount /dev/ad0s2a /mnt". If it 
doesn't mount then abort. Run fdisk again and change the values back to 
what they were initially.
8) Edit your fstab to update the slice numbers. e.g. "vi 
/mnt/etc/fstab" or "sed -e "s/ad0s1/ad0s2/g" < /mnt/etc/fstab > 
/mnt/etc/" followed by a sanity check and a couple mv commands.
9) Unmount your root partition, e.g. "umount /mnt".
10) Reboot and verify that your FreeBSD installation is still alive.
11) Carry on...

This information comes with no warranty. :)


More information about the freebsd-questions mailing list