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 24th June 2008
kienjakenobi's Avatar
kienjakenobi kienjakenobi is offline
Kienja
 
Join Date: Apr 2008
Posts: 57
Thanked 8 Times in 7 Posts
Default Change the Size of a Slice

Quick question:

I imagine many of you knew the answer to my question just after looking at the title of my topic, but here it is:

Is it possible to increase the size of a FreeBSD slice? It seems to me the obvious answer should be yes, but I have not really found any way to do it. The closest I got was when I was tinkering around with parts of fdisk I have never used (Not from sysinstall), but it appeared I was editing nothing more than configuration files. Either way, I have not found a definitive answer saying that it IS or is NOT possible, so I would like to know what the case is.

Please note that I do mean slice and not partition, as is described in the FreeBSD handbook:
http://www.freebsd.org/doc/en/books/...anization.html
Reply With Quote
  #2   (View Single Post)  
Old 24th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Quote:
Originally Posted by growfs manual
The growfs utility extends the newfs(8) program. Before starting growfs
the disk must be labeled to a bigger size using bsdlabel(8). If you wish
to grow a file system beyond the boundary of the slice it resides in, you
must re-size the slice using fdisk(8) before running growfs. If you are
using volumes you must enlarge them by using vinum(8).
growfs(8) talks a bit more about it but that is the jist of it. As I understand it :


back it up

resize it in fdisk

modify the label in disklabel/bsdlabel

growfs the file systems as necessary.


Note, I ain't never done it and don't plan on doing it anytime this century ^_^.
__________________
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
  #3   (View Single Post)  
Old 24th June 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Thanked 25 Times in 24 Posts
Default

fdisk can be used to resize slices. (actually it is same as creating new slice table)

bsdlabel can be used to resize bsd labels, and growfs can be used than to "fix" already presented file systems on resized label (so you do not need to backup data and recreate fs with newfs).

Beware that growfs is used only for labels with increased size, labels with decreased size are broken already - possibility of losing data is highly present - which can be fixed only with newfs.

If you plan to increase slice over some other one, you must backup (at least) data on slice which is going to be decreased in size. After first slice get increased in size, use "bsdlabel -e" to edit labels.

When editing labels, you should only increase last label size(keeping all offsets same) and use growfs only on that one (last label) - there is no utility that change label offset and at same time keep/change its size.

Of course you can edit labels as you like but I'm 100% sure that decreased labels can be malfunctioning (I never tried this) and increased labels will semi work (some files will not be accessible) until growfs is used on that label(or until newfs recreate fs - loosing any previous data).

So answer is something like no/yes,if you care for your data, otherwise anwser is always yes .
Depends if you are interested in not recreating fs(/not using backup) on increased last label of increased slice. Solution for decreased slice(with labels) should always be backup. Of course if you increase slice and do not edit table of labels on that slice, nothing will got wrong with (that)slice - but you will lost usefull disk space.

I hope that it's not so complicated to understand what I written. (if you use only one label it becomes very simple)

Whatever you do, always make backup.

Last edited by richardpl; 24th June 2008 at 11:15 AM.
Reply With Quote
  #4   (View Single Post)  
Old 24th June 2008
kienjakenobi's Avatar
kienjakenobi kienjakenobi is offline
Kienja
 
Join Date: Apr 2008
Posts: 57
Thanked 8 Times in 7 Posts
Default

Thanks very much, both of you.

I have only one slice, so I intend to increase the size of that slice into empty disk space, so I am not increasing it into space that is all ready occupied by another slice. That simplifies the process a lot. Also, within that single slice I have three partitions/labels: boot (USF2), swap, and a very large ZFS that contians all tmp, usr, and var files. I intend to increase the ZFS partition into the space opened up once the slice is increased by fdisk.

I think I understand this to mean I would need to:
1. Resize the label with fdisk
2. Resize BSDlabel containing the ZFS filesystem with bsdlabel
3. Resize/"fix" the ZFS filesystem within the resized label with growfs
(Ah! I see this is the same list that TerryP gave!)

I think this all makes sense now.
Reply With Quote
  #5   (View Single Post)  
Old 24th June 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

i don't know for sure but i think that won't do.

how about:
1. Resize the slice using 'fdisk'
2. run 'bsdlabel -e' and then:
3. change the 'c' partition to the new size.
4. add a new partition to use up the extra space
5. add this new partition to the zfs pool (zpool add).
Reply With Quote
  #6   (View Single Post)  
Old 25th June 2008
18Googol2's Avatar
18Googol2 18Googol2 is offline
Real Name: whoami
Spam Deminer
 
Join Date: Apr 2008
Location: pwd
Posts: 283
Thanked 20 Times in 18 Posts
Default

Quote:
Originally Posted by kienjakenobi View Post
Quick question:

I imagine many of you knew the answer to my question just after looking at the title of my topic, but here it is:

Is it possible to increase the size of a FreeBSD slice? It seems to me the obvious answer should be yes, but I have not really found any way to do it. The closest I got was when I was tinkering around with parts of fdisk I have never used (Not from sysinstall), but it appeared I was editing nothing more than configuration files. Either way, I have not found a definitive answer saying that it IS or is NOT possible, so I would like to know what the case is.

Please note that I do mean slice and not partition, as is described in the FreeBSD handbook:
http://www.freebsd.org/doc/en/books/...anization.html
Did you do it at single user mode? Since there is only 1 slice in your system, it is root dir and it is not gonna work because the growfs ultility requires the slice totally unmounted to process.

What I did last time is took out the disk and put it in another system. Doesnt sound an elegant solution really, then I realize I could do it with the FreeBSD CD but havent had a chance to try it out
__________________
The power of plain text? It can control an entire OS
Reply With Quote
  #7   (View Single Post)  
Old 25th June 2008
kienjakenobi's Avatar
kienjakenobi kienjakenobi is offline
Kienja
 
Join Date: Apr 2008
Posts: 57
Thanked 8 Times in 7 Posts
Default

Yes, I think I would have to do this in single user mode. That should make the root partition no longer a problem because the system can do its usual boot without the root partition. Because ZFS does not have boot support yet, the only way around that is to keep a UFS partition with all of the needed information to do a successful boot without the ZFS partition.

I might end up doing this using a FreeBSD install disk anyway because I have empty space in front of my root partition and behind my ZFS partition. I have no desire to enlarge the root partition, so I will have to copy the partition and then recreate it at the front of the disk. Then I will have to delete and recreate the swap partition, and then I would be able to enlarge the ZFS partition both to the right and to the left of the disk.

ephemera, I think your method makes more sense when using ZFS, but I have some questions:

Quote:
Originally Posted by ephemera
3. change the 'c' partition to the new size.
4. add a new partition to use up the extra space
5. add this new partition to the zfs pool (zpool add).
I actually do not have a c partition.
boot: ar0s2a
swap: ar0s2b
ZFS (Everything else): ar0s2d

Therefore, I suppose by the c partition you just mean the ZFS partition?

If I understand this correctly, after enlarging the ZFS partition, I would then create a new ZFS pool to fill the empty space within the enlarged parition. Then I could merge that new ZFS pool with the all ready existant one, which would leave me with a partition completely filled by the ZFS filesystem. Whew! I suppose that should work, but I wonder how I am going to tell ZFS the exact location within the partition to begin and end the new pool. I will have to look into some documentation on ZFS's tools.
Reply With Quote
  #8   (View Single Post)  
Old 25th June 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

> Therefore, I suppose by the c partition you just mean the ZFS partition?

the 'c' partition refers to the whole slice. if you don't have it then skip step 3.
Reply With Quote
  #9   (View Single Post)  
Old 26th June 2008
richardpl richardpl is offline
Spam Deminer
 
Join Date: May 2008
Location: Croatia
Posts: 284
Thanked 25 Times in 24 Posts
Default

Quote:
Originally Posted by kienjakenobi View Post
3. Resize/"fix" the ZFS filesystem within the resized label with growfs
No, growfs(8) only supports UFS file system.
Reply With Quote
Old 27th June 2008
kienjakenobi's Avatar
kienjakenobi kienjakenobi is offline
Kienja
 
Join Date: Apr 2008
Posts: 57
Thanked 8 Times in 7 Posts
Default

Quote:
Originally Posted by richardpl
No, growfs(8) only supports UFS file system.
Yes, thank you. ephemera set me straight on this process with ZFS.
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
Moving linux partitions out of the BSD disklabel/slice fbsduser NetBSD Installation and Upgrading 5 4th March 2009 07:07 AM
CLI font size idefix FreeBSD General 3 7th February 2009 11:19 AM
Negative partition size? giga FreeBSD General 1 2nd January 2009 09:02 PM
Backup getting too big, how to estimate the size after thinnig out? PatrickBaer FreeBSD General 9 24th July 2008 12:59 PM
apache fd size problem oxy FreeBSD Ports and Packages 0 10th May 2008 10:49 AM


All times are GMT. The time now is 11:04 AM.


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