# Resize slices



## FR (Mar 15, 2013)

Hi,

My /tmp is 1GB and I need to resize it to 4.5GB. I don't have any space left on the disk so I need to get the space from /usr. How do I do this without losing any data from /usr?

Thanks.


----------



## SirDice (Mar 15, 2013)

Backup the data, remove the partitions, create new ones, restore data.

But besides that, how much swap does that machine have? tmpfs(5) might be a simpler solution.


----------



## FR (Mar 15, 2013)




----------



## SirDice (Mar 15, 2013)

4GB + whatever memory you have, should cover that needed 4.5GB.

Get to single user mode: `# init 1`

Then:
`# rm -rf /tmp/*`  # we don't need whatever is in there anymore
`# umount /tmp` # unmount the 'old' tmp
Edit /etc/fstab and change the entry for /tmp/:

```
tmpfs           /tmp    tmpfs   rw,mode=1777    0       0
```

Mount /tmp/ again and exit. Or simply reboot.


----------



## FR (Mar 15, 2013)

*O*k, done. What do I do next?


----------



## SirDice (Mar 15, 2013)

Use it?


----------



## FR (Mar 15, 2013)

Oh ok I see. Sorry I thought this would actually resize the /tmp slice. But this seems to work. the reason I needed a bigger /tmp is because mysql was creating very large temp tables causing webpage errors.
Is this a stable solution or do I need to repartition anyway? Is this tmpfs using any RAM?


----------



## SirDice (Mar 15, 2013)

FR said:
			
		

> Is this a stable solution or do I need to re partition anyway? Is this tmpfs using any RAM?



It's a stable solution, I've been using it for quite some time on various machines and I haven't encountered any issues. tmpfs(5) uses RAM+Swap, it's a great way to make use of otherwise unused swap space.

In combination with MySQL you may want to limit its size so there's enough left for MySQL. Some tweaking will go a long way.


----------

