# Resize Freebsd slice



## everypot (Apr 16, 2010)

I have both FreeBSD and windows xp installed (single disk). Now I want to get rid of windows by deleting the windows partition and merging it into the FreeBSd slice. I tried sysinstall -> configure -> fdisk, 






where the 2nd and 5th slices are associated with windows xp.  But I don't know what to do next without losing my data on the existing FreeBSD slice. I don't want to reinstall FreeBSD.


----------



## SirDice (Apr 16, 2010)

Backup and reinstall. There's nothing else you can do.


----------



## Beastie (Apr 16, 2010)

Why? He may not be able to merge everything back into a single slice, but at least he can edit the MBR using fdisk(8), change the sysid of his Windows partitions to 165 and reclaim all the space with newfs(8).
That should work and he shouldn't lose too much space for the extra slices.


----------



## mururoa (Apr 16, 2010)

Beastie said:
			
		

> Why? He may not be able to merge everything back into a single slice, but at least he can edit the MBR using fdisk(8), change the sysid of his Windows partitions to 165 and reclaim all the space with newfs(8).
> That should work and he shouldn't lose too much space for the extra slices.



I would install GAG or FreeBSD loader before touching anything or at least make sure he has no need of NFTS to boot. In case he's using windows bootloader to start FreeBSD he might get in trouble just bashing the ntfs partition without care.


----------



## phoenix (Apr 16, 2010)

While it may be possible to reclaim the space in s1 and s3, it will not be pretty.  

First, make sure you can boot without using any DOS/Windows tools.  Either install a boot manager into the MBR, or overwrite the MBR with the standard FreeBSD one.  Either way, mark s2 as the active partition.

Then use sade(8) (don't ever use sysinstall except to install the OS), delete s1 and s3, create new s1 and s3.  Then create a single partition in each slice and format them.  Finally, mount those new filesystems somewhere.

The ugly part comes with deciding where to mount the new filesystems, and how to replace existing directories (/usr/local or /home, for instance) with these filesystems.  

Much cleaner to just backup, reinstall with a single slice, and go from there.


----------



## leopard (Apr 17, 2010)

Buy an external drive, tar your root filesystem and save it on the external. Then boot with a livecd, reformat the disk how you like, and extract the tar to your new slice. Time consuming, perhaps, but it will end up like nothing happened, and you'll have the extra space of the windows partitions to mount /usr or /home to or however you like to setup your system.


----------

