DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default Resizing /usr

Hey all

My current situation is as follows:

windows 20GB
free 20GB
FreeBSD 7.XXGB
-- / 500MB
-- /tmp 300MB
-- /usr 6GB
-- /var 500MB
Ubuntu 30GB

As the title suggests, I want to resize my /usr partition to occupy the free 20GB.

Please note:

1) I have no other drive to backup FreeBSD to
2) I am not connected to any other machine to which I can send the data
3) This is my laptop, and I'm willing to experiment anything that may lead to loss of data, as long as it might work
4) I am NOT willing to reinstall, I have just built too much from source and it has taken a long time..
5) I'm kinda new to FreeBSD...

I've searched around for a while, but found nothing interested..

Any help?

Thanks

Last edited by abdo88; 7th July 2008 at 04:12 PM. Reason: Adding partitions in FreeBSD slice
Reply With Quote
  #2   (View Single Post)  
Old 7th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

Why would you like to resize /usr
Why not to use free space to create /home ?

p.s. I'm new to freebsd as well, but i don't think you can resize drive without using another drive to backup data....
Otherwise
you could use dump and restore (haven't tried to use it for resizing, but i think it should work)
Reply With Quote
  #3   (View Single Post)  
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default

Thanks for the reply... From your reply, you probably work on Linux... I'm not having any problem with home... However, my major concern is with /usr (this is where all the action goes on...) especially that I'm intending to build X and KDE..

About dumping, dump to where? I have no other hard disks and no network connections...
Reply With Quote
  #4   (View Single Post)  
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default Easier problem...

OK, here is an easier problem.... If I archive /etc, /boot and /usr and burn the archives to CDs/DVDs... If I reinstall and paste these back, will my exact same system be back the way it was??

Last edited by abdo88; 7th July 2008 at 05:27 PM.
Reply With Quote
  #5   (View Single Post)  
Old 7th July 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Default

You can use geom(8) gconcat(8) utility for adding aditional free space to /usr label.

Explore GEOM and its modules for more information.

Note that philosophy is different than what is currently provided in other alternative operating systems.
Reply With Quote
  #6   (View Single Post)  
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default

Was that a reply to my first or second question ?

In either case, could you please elaborate a bit more?
Reply With Quote
  #7   (View Single Post)  
Old 7th July 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Default

For your first question, second one is dumb.

Read both manual pages, provided as link in my previous post. Than read other manual pages listed in SEE ALSO in every manual page.
Reply With Quote
  #8   (View Single Post)  
Old 7th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

Quote:
Originally Posted by abdo88 View Post
Thanks for the reply... From your reply, you probably work on Linux... I'm not having any problem with home... However, my major concern is with /usr (this is where all the action goes on...) especially that I'm intending to build X and KDE..

In situation like this I move /usr/ports (and if necessary /var/tmp) to /home and make symbolic link to them...
This is how i compiled OpenOffice on my PC
After that i move them back

/ 512M
/tmp 512M
/usr 12GB (ain't enough to compile OpenOffice, only 5.3GB is free)
/var 3GB

Note that if you do like i did, then later recompiling some other apps, make sure to remove work (or what was the correct name) directory, otherwise there will be problems during compilation

Last edited by graudeejs; 7th July 2008 at 06:29 PM.
Reply With Quote
  #9   (View Single Post)  
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default

That's actually quite a nice idea!! It never occurred to me... So one more question how do I enlarge the FreeBSD slice (partition magic et al. won't recognize it)?

Last edited by abdo88; 7th July 2008 at 06:45 PM.
Reply With Quote
Old 7th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

How much you free space you got on Ubuntu drive????
If it's enough, you could use it to store /usr backup...
you will need 1 to 6 GB free space (depends if you will or not compress backup).... hmm, but restore works only on UFS, so you might need to use tar, but that might make some problems (with links maybe, idk, read man tar)

Last edited by graudeejs; 7th July 2008 at 06:36 PM.
Reply With Quote
Old 7th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

*My Personal Opinion*

Use the free 20GB to create a new slice with several partitions, where ever your 'bulges' will be and mount them or create a big slice/1partition and symlink them from a diff mount point.


It is less trouble then relabing the disk and having to go through updating stuff, especially since you have so little backup options and extra disk space available for it.



e.g.

freespace -> ad0sX
ad0sXa -> /usr/local
ad0sXb -> /usr/src
ad0sXd -> /usr/obj
ad0sXe -> /usr/ports

or

ad0sXa -> /where/ever

and create sym links to /usr/{obj,src,ports,local} to /where/ever/{obj,src,ports,local}.




For example, my file server recently got a second hard drive.


I dumped the contents of /usr/local, deleted the old, formated a slice with a partitioin for it and mounted it on /usr/local and then restored the files.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 7th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default Great idea! Thanks

Thanks a lot! This seems so far like the (almost) optimal solution...

However, I have 2 questions in mind:

1) Can I change the partition mounted as /usr ?
2) If yes, can the new /usr partition be on a different slice?

If the answer to the above 2 is yes, I am thinking of making the 20GB free space into a /usr and using the 6 for smthg else (e.g. /home)...

EDIT: that is make the 20GB another 1-slice partition..
EDIT: in case this works, will it hurt the performance? if yes, to what extent?

Last edited by abdo88; 7th July 2008 at 11:37 PM.
Reply With Quote
Old 8th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

yeah as long as you update the /etc/fstab file correctly.


basically some thing like this would *probably* work:

Code:
# fdisk ad0
   ... use fdisk to create the partition from the free space, hence forth called ad0sX
# bsdlabel -e ad0sXa
     ... create the disk label for the new slice
# newfs /dev/ad0sXa
# mount /dev/ad0sXa /mnt
# tar -cf - -C /usr . | tar -xvpf - -C /mnt
   ... copies files over
vi /etc/fstab
   ... change the device being mounted on /usr
   ... if you have a preferred screen editor instead of vi, feel free to use it
reboot
if the free space partition is ad0s2a (ad0sXa in the above) and your old /usr partition is ad0s3e you would change the ad0s3e to ad0s2a in your /etc/fstab file.

Code:
# mount /dev/ad0sYz /mnt
   .. where ad0sYz was your old /usr partition (e.g. ad0s3e in the above)
# rm -rvf /mnt/*
and do whatever you want with the old partition.



It's not exactly how I would do it but close enough. The reason for the reboot is because you may have programs stored in /usr that are running while doing this and it is best not to delete the data files while running the programs! Rebooting is not necessary but, you could say makes the process simpler to follow without bringing the system to single user mode (which would generally be best imho).



Note: I have not used FreeBSDs 'bsdlabel' in ages and of course assume no responsibility for the accuracy or inaccuracy of any of this.


If your not familiar with using bsdlabel you can always use the -n switch to it which will do a 'dry run' that won't *actually* write changes out, e.g. bsdlabel -ne ad0
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

Last edited by TerryP; 8th July 2008 at 12:18 AM.
Reply With Quote
Old 8th July 2008
abdo88 abdo88 is offline
Port Guard
 
Join Date: Jul 2008
Posts: 10
Default

Thanks a lot for the help... Unfortunately, I had to just give up and reinstall BSD... since I cannot create more than 4 primary slices :S...

Anyways, thanks a lot to all those who helped...
Reply With Quote
Old 12th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

Just for record

I just found this in FreeBSD handbook by accident...
  • Important: FreeBSD features the growfs(8) command, which makes it possible to increase the size of file system on the fly, removing this limitation.
Reply With Quote
Old 12th July 2008
ninjatux's Avatar
ninjatux ninjatux is offline
Real Name: Baqir Majlisi
Spam Deminer
 
Join Date: May 2008
Location: Antarctica
Posts: 293
Default

Quote:
Originally Posted by richardpl View Post
You can use geom(8) gconcat(8) utility for adding aditional free space to /usr label.

Explore GEOM and its modules for more information.

Note that philosophy is different than what is currently provided in other alternative operating systems.
That's the answer. Making symbolic links is just a way of getting around a possible persisting problem.
__________________
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity."
MacBook Pro (Darwin 9), iMac (Darwin 9), iPod Touch (Darwin 9), Dell Optiplex GX620 (FreeBSD 7.1-STABLE)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing FreeBSD partition Cloud FreeBSD General 3 28th June 2008 03:40 AM


All times are GMT. The time now is 05:59 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick