# 8.2 leftover disk space



## ReAX222 (Apr 26, 2011)

So I like having a spare amount of space for my files, so when I kill an OS, my stuff remains.  So My last install it didn't work so well, when I gave my OS 100gb and kept a  200gb area for /home, I kept getting getting an error about invalid partition table.  So the last time I only made the 100gb for the OS and figured I could create the other partition after I get the system running.  Now I'm trying to, and I can't save the slice. 

I tried the sysinstall method, where I start sysinstall, configure, fdisk and create a new slice.  It wasn't saving, I also tried using "A" and using the whole disk.  That wouldn't save either.  Is there a graphical or another way to save the free space as a new partition?


----------



## wblock@ (Apr 26, 2011)

After you've installed the system, stop using sysinstall.  Really.  Even sade(8), the disk editor part stripped out of sysinstall, doesn't manage to work easily.  The base tools are fdisk(8) and bsdlabel(8), and the new contender is gpart(8).  Here's a quick overview of both: Disk Setup On FreeBSD.  Don't follow it exactly unless you want to wipe the disk and start over.


----------



## ReAX222 (Apr 26, 2011)

It looks pretty, but how say I created a slice of 1/3 of my drive and filled it with default partitions.  What code do I change to use the unsliced free space of ad4.  ad4s1 exist and I don't want to loose it.

And just for my betterment, is there an issue with slice 1 having to be the booting OS?  For some reason, I was creating my OS slice first and the user data slice second and it kept getting them backwards.  I'm assuming because it called my larger (user data) slice ad4s1 and the slice I intended for the OS ad4s2 that was why I got the invalid part table.


----------



## wblock@ (Apr 26, 2011)

ReAX222 said:
			
		

> It looks pretty, but how say I created a slice of 1/3 of my drive and filled it with default partitions.  What code do I change to use the unsliced free space of ad4.  ad4s1 exist and I don't want to loose it.



Then back it up now, before running anything that messes with the partition or slice table.

"Unsliced" doesn't mean anything to me.  If you have free space at the end of the drive and want to add another FreeBSD partition, use bsdlabel(8) with -e to edit the existing label.  It will be another partition in the current slice, in FreeBSD terminology.



> And just for my betterment, is there an issue with slice 1 having to be the booting OS?



No, but it may have been an issue with which slice was active.  Or just sysinstall not being able to do advanced things.


----------



## ReAX222 (May 29, 2011)

Working on this again.

```
Hera# sysctl kern.geom.debugflags=16
kern.geom.debugflags: 16 -> 16
Hera# fdisk -BI ad4
******* Working on device /dev/ad4 *******
fdisk: Class not found
Hera# gpart create -s gpt /dev/ad4
gpart: geom 'ad4': File exists
Hera# gpart show ad4
=>       63  312581745  ad4  MBR  (149G)
         63  112581441    1  freebsd  [active]  (54G)
  112581504  200000304       - free -  (95G)

Hera# gpart add -l usbhome -t freebsd-ufs ad4
gpart: Invalid argument

Hera# gpart show ad4
=>       63  312581745  ad4  MBR  (149G)
         63  112581441    1  freebsd  [active]  (54G)
  112581504  200000304       - free -  (95G)

Hera# gpart add -s 95000000000 -t freebsd-ufs ad4
gpart: autofill: No space left on device
Hera# bsdlabel -e ad4s6
bsdlabel: unable to get correct path for ad4s6: No such file or directory
Hera# bsdlabel -w -B ad4s6
bsdlabel: unable to get correct path for ad4s6: No such file or directory
Hera#
```

It looks like ad4 (my hdd) is the full disk space of 149Gb, of which 54Gb is already allocated for the OS.  The remaining 95 is unallocated and I can't find a way to write it.  Am I doing it wrong?


----------



## ReAX222 (May 29, 2011)

Cool, I got [CMD="gpart"][/CMD] to initialize a back up drive(external).  Thanks again for that link.


----------



## wblock@ (May 29, 2011)

Best to use either fdisk/bsdlabel or gpart, not both.


----------



## ReAX222 (May 30, 2011)

Neither would work and I screwed it all up.  So I reinstalled and kept it under the same partition, just its own mount point.  Luckily I actually did a back up.


----------

