# Extending a slice -- possible?



## tomh009 (May 21, 2010)

I have a question that may have a very simple answer: is there a way to safely modify the size of a slice (fdisk partition)?  I have a system running on a local RAID array that I have extended from 1 TB to 2 TB, and I would like to have a 1.5 TB file system on it.  I'm willing to delete the last file system on the current slice in order to create a new one (or use growfs if appropriate), but first I have to have a bigger slice.  And I really would prefer not to do an install from scratch.

This the current partition table:

```
Disk name:      da0                                    FDISK Partition Editor
DISK Geometry:  243147 cyls/255 heads/63 sectors = 3906156555 sectors (1907303MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         63         62        -     12     unused        0
        63 1953070182 1953070244    da0s1      8    freebsd      165
1953070245 1953096539 3906166783        -     12     unused        0          


The following commands are supported (in upper or lower case):

A = Use Entire Disk   G = set Drive Geometry   C = Create Slice   F = `DD' mode
D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Wizard m.
T = Change Type       U = Undo All Changes     W = Write Changes
```

Is there a way to edit the partition table without losing the existing file systems?

The other option I thought of was using ZFS and zpool to combine storage from two separate partitions into a singe file system.  Unfortunately this server is still running 6.1-RELEASE so no ZFS -- but maybe it's worth going through doing an upgrade if there is no way to extend the slice.

Any advice would be most welcome ...


----------



## aragon (May 21, 2010)

If you simply make the existing slice larger without modifying its start offset, your file systems should be ok.  I'm assuming you have a BSD label on the slice?  Use fdisk(8).  Not sure sysinstall/sade will cut it...

Make a backup of your MBR before any changes, make the changes in single user mode (or on another system), and boot the drive into single user mode to check all your data is in tact afterwards.

If it doesn't work, restore your backed up MBR.


----------



## tomh009 (Jun 5, 2010)

Thanks -- finally got a chance to do this (needed to schedule this to minimize risk).  Using fdisk to resize the slice to the full disk worked fine; I then followed that up with a bsdlabel, and then needed to reboot in order for growfs (or probably some underlying subsystem) to fully recognize the new size.

After that, growfs worked well to expand the file system.  A now have the file system expanded to 2 TB (well, really 1.8 TB).  

Thanks for the advice!


----------



## dennylin93 (Jun 5, 2010)

Can you post the details of how you did it?


----------

