# resize partition



## tantra35 (Nov 8, 2010)

After installation FreeBSD 8.0 on server our hoster forget make /tmp partition, and we haven't noticed about it. But now we want /tmp as suspect.

I try to use gpart but without success. I do follow. On server exists /home partition about 500GB, so i whnat to extent /tmp from /home.

At initial state:

```
freebsd# gpart show
=>        32  1171743776  da0  MBR  (559G)
          32  1171743328    1  freebsd  [active]  (559G)
  1171743360         448       - free -  (224K)

=>         0  1171743328  da0s1  BSD  (559G)
           0     2097152      1  freebsd-ufs  (1.0G)
     2097152    41943040      4  freebsd-ufs  (20G)
    44040192    83886080      5  freebsd-ufs  (40G)
   127926272     8388608      2  freebsd-swap  (4.0G)
   136314880  1035428448      6  freebsd-ufs  (494G)            <---- /home
```


so i do follow, backup /home on other server, then umount /home


```
freebsd# umount /home
```

then i delete home:


```
freebsd# gpart -i 6 da0s1
freebsd# gpart show
=>        32  1171743776  da0  MBR  (559G)
          32  1171743328    1  freebsd  [active]  (559G)
  1171743360         448       - free -  (224K)

=>         0  1171743328  da0s1  BSD  (559G)
           0     2097152      1  freebsd-ufs  (1.0G)
     2097152    41943040      4  freebsd-ufs  (20G)
    44040192    83886080      5  freebsd-ufs  (40G)
   127926272     8388608      2  freebsd-swap  (4.0G)
   136314880  1035428448      6  - free -  (494G)
```

then i add 2 partitons:

```
freebsd# gpart add -s 8388608 -t freebsd-ufs da0s1
added da0s1f

freebsd# gpart add -t freebsd-ufs da0s1
added da0s1g
```
now my partition looks like:

```
freebsd# gpart show 
=>        32  1171743776  da0  MBR  (559G)
          32  1171743328    1  freebsd  [active]  (559G)
  1171743360         448       - free -  (224K)

=>         0  1171743328  da0s1  BSD  (559G)
           0     2097152      1  freebsd-ufs  (1.0G)
     2097152    41943040      4  freebsd-ufs  (20G)
    44040192    83886080      5  freebsd-ufs  (40G)
   127926272     8388608      2  freebsd-swap  (4.0G)
   136314880     8388608      6  freebsd-ufs  (4G)
   144703488  1027039840      7  freebsd-ufs  (490G)
```


And finally I try to mount new partition:


```
freebsd# mount /dev/da0s1g /home
```

And got error invalid argument

Why this happens? And how to resize partition on working system?


----------



## sk8harddiefast (Nov 8, 2010)

Please use "*#*" symbol, to do it like this:

```
At initial state:
freebsd# gpart show
=> 32 1171743776 da0 MBR (559G)
32 1171743328 1 freebsd [active] (559G)
1171743360 448 - free - (224K)

=> 0 1171743328 da0s1 BSD (559G)
0 2097152 1 freebsd-ufs (1.0G)
2097152 41943040 4 freebsd-ufs (20G)
44040192 83886080 5 freebsd-ufs (40G)
127926272 8388608 2 freebsd-swap (4.0G)
136314880 1035428448 6 freebsd-ufs (494G) <---- /home
```
Will be easier to read it 


> And how to resize partition on working system?


Is not actually resize of partition but could do the job.
Take for example that /home is full . You could copy /home to /usr, remove /home from / and make ln -s of /usr/home on /


----------



## wblock@ (Nov 8, 2010)

tantra35 said:
			
		

> then i add 2 partitons:
> 
> ```
> freebsd# gpart add -s 8388608 -t freebsd-ufs da0s1
> ...



First, expect DD to be along to remind you to use proper formatting.  I've added 'code' tags above.

Anyway, did you remember to newfs(8) the added partitions?  Reallocating space does not adjust the filesystems.


----------



## tantra35 (Nov 8, 2010)

Thanks for replay.

I really forget do newfs. Now all ok


----------

