How can I repartition my drive?

Garrett Cooper youshi10 at u.washington.edu
Tue Dec 5 09:15:34 PST 2006


Jerry McAllister wrote:
> On Tue, Dec 05, 2006 at 10:33:54AM +0300, Abdullah Al-Marrie wrote:
>
>   
>> Hello,
>>
>> How can I repartition my drive? I already have the hd dedicated for
>> FreeBSD and 6.2-RC1 is installed.
>>
>> Is there away to make /var ..etc without reinstalling the OS?
>>     
>
> Well, I don't know what you mean by making /var ..etc, but there
> are things to do if you need to move some things to shift them
> to where there is more space.   For this you do not repartition,
> but just move certain directory trees and then make symbolic links.
>
> Here is an example.   Let's say you have a typical setup with one
> large /home file system that has lots of spare space, but you have
> begun to fill /var because you have lots of stuff in /var/log and /var/spool.
> So, you want to move the contents of /var/log and /var/spool in to
> the /home space where they have room to grow.   Do something like this:
>
> (While logged in as root - or booted to single user [preferred])
>   cd /var/log 
>   tar cvpf /home/log.tar *
>   cd /var/spool
>   tar cvpf /home/spool.tar *
>   cd /home
>   mkdir var.log
>   mkdir var.spool
>   cd var.log
>   tar xvf ../log.tar
>   cd ../var.spool
>   tar xvf ../spool.tar
>   cd /var
>   mv log log-old
>   ln -s /home/var.log log
>   mv spool spool-old
>   ln -s /home/var.spool spool
>
> Now, just check things out to make sure it is all OK.
>   cd /var/log
>   pwd             (should display /home/var.log)
>   ls              (should have the right stuff for log in it)
>   cd /var/spool  
>   pwd             (should display /home/var.spool)
>   ls              (should have the right stuff for spool in it)
>
> If all is well, clean up.
>   cd /var
>   rm -rf log-old
>   rm -fr spool-old
>   cd /home
>   rm log.tar
>   rm spool.tar
>
> That will leave space in /var and give log and spool to work
> The same type of thing can be done with other directories in overloaded
> file systems if you have room for them elsewhere.  Just don't do it for
> some things like /etc or /sbin that need to stay in root.
>
> There is something called growfs, but it is only useful if you have
> empty unallocated space right next to the partition you want to expand.
> That is rarely the case.   Most people put one partition right after
> the other without leaving wasted space in between.
>
> There are also some other utilities that claim to be able to mush FreeBSD 
> (as well as other types) partitions around, but I have not heard much about 
> them.   Most disk partition management utilities actually work on Microsoft 
> partitions which are what FreeBSD calls slices.   They do not know anything
> about FreeBSD partitions - which are actually subdivisions of slices.
>
> So, if you do not have the room to do the move and symlink process I
> describe above, then, you are probably needing to look at buying larger
> disk.
>
> Happy disk management,
>
> ////jerry
>   
>   
>> Thank you,
>>
>> Abdullah
>> Arab Portal
>> http://www.WeArab.Net/
>>     

    If you don't have any free partition space, you will need to backup 
a partition and delete it to resize things on your disk using 
sysinstall, which may require that you backup your entire disk and 
reinstall from scratch. For resizing NTFS partitions (if your system's 
dual-boot): <http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html>. 
Googling for "resize {filesystem type}" will yield the answers to most 
questions that you might have about resizing any particular filesystem 
partition that you may have, but UFS2 support isn't available IIRC..
-Garrett


More information about the freebsd-questions mailing list