RE: How to add unused space to an existing install

2013-02-07 Thread Paul Schmehl

--On February 6, 2013 5:21:39 PM -0600 dte...@freebsd.org wrote:





-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Paul Schmehl
Sent: Wednesday, February 06, 2013 9:59 AM
To: FreeBSD Questions List
Subject: How to add unused space to an existing install

I have a FreeBSD 8.3 RELEASE box that we recently discovered only has
part of the disk being used.  This box has four 1TB drives in RAID 5,
and df only shows 500MB of disk available.

fdisk shows this:
# fdisk -p
# /dev/mfid0
g c364602 h255 s63
p 1 0xa5 63 1562363771
a 1

When I run the fdisk editor in sysinstall I see this:

Disk name:  mfid0  FDISK Partition
Editor
DISK Geometry:  364602 cyls/255 heads/63 sectors = 5857331130 sectors
(2860024MB)

Offset   Size(ST)End Name  PType   Desc  Subtype
Flags

 0 63 62- 12 unused0
63 1562363771 1562363833  mfid0s1  8freebsd  165
1562363834 4294981702 5857345535- 12 unused0

I want to capture all that unused space and add it to the server.

fstab has this:
# cat /etc/fstab
# DeviceMountpoint  FStype  Options Dump
Pass#
/dev/mfid0s1b   noneswapsw  0   0
/dev/mfid0s1a   /   ufs rw  1   1
/dev/mfid0s1e   /home   ufs rw  2   2
/dev/mfid0s1d   /tmpufs rw  2   2
/dev/mfid0s1f   /usrufs rw  2   2
/dev/mfid0s1g   /varufs rw  2   2
/dev/acd0   /cdrom  cd9660  ro,noauto   0   0

When I try to create a new slice using fdisk, it doesn't seem to work.


Did you try something like:

echo p 2 165 * * | sudo fdisk -f- /dev/mfid0

??


Thank you for your detailed and informative answer.

I did not.  I'm a neophyte in the disk world.  I've always used sysinstall 
to setup partitions and mount points.




Afterward fdisk -p should show something like...

# /dev/mfid0
g c364602 h255 s63
p 1 0xa5 63 1562363771
p 2 0xa5 num num
a 1

And then you'll have /dev/mfid0s2 which you can do-with what you like
(directly newfs the slice or create BSD partitions underneath that to
further sub-divide into as many as 8 smaller units, /dev/mfid0s2[a-h]).



I've been doing some more research on this problem, and I've discovered 
that bsdlabel has a 2 to the 32nd limit on disk size.  It appears I have to 
use gpart instead.  Is that not correct?





If I move to the label editor, I get this:

 FreeBSD Disklabel Editor

Disk: mfid0 Partition name: mfid0s1 Free: 0 blocks (0MB)

Part  Mount  Size Newfs   Part  Mount  Size Newfs
  -   -     -   -
mfid0s1a  none   2000MB *
mfid0s1d  none  65536MB *
mfid0s1e  none   4096MB *
mfid0s1b  swap65536MB SWAP
mfid0s1f  none  10240MB *
mfid0s1g  none601GB *

As you can see mfid0s1g is 601GB, and according to fstab that's /var.

Yet df -h shows:

# df -h
Filesystem   SizeUsed   Avail Capacity  Mounted on
/dev/mfid0s1a1.9G726M1.0G41%/
devfs1.0k1.0k  0B   100%/dev
/dev/mfid0s1e3.9G 38M3.5G 1%/home
/dev/mfid0s1d 62G6.6M 57G 0%/tmp
/dev/mfid0s1f9.7G7.5G1.4G84%/usr
/dev/mfid0s1g582G 39G496G 7%/var

So apparently I'm not creating this new slice?  It should be
/dev/mfid0s1h, correct?



Let's not confuse slices (DOS partitions) with disklabels (BSD
partitions).


OK.  I've clearly done that.  As I say, I'm a neophyte in the disk geometry 
and configuration field.




DOS partitions are (maximum 4 per disk):

mfid0s1
mfid0s2
mfid0s3
mfid0s4

(according to your fdisk -p output, you're mfid0 disk is currently only
using mfid0s1)

BSD partitions are (maximum 8 per slice aka DOS partition):

mfid0s1a
mfid0s1b
mfid0s1c
mfid0s1d
mfid0s1e
mfid0s1f
mfid0s1g
mfid0s1h

(according to your sysinstall output, you're mfid0s1 slice has 5 BSD
partitions -- a, e, d, f, and g)



I see.




How to I recapture the remaining 2+TB of space that's not being used?



The easiest way to use your extra space is to not adjust one of those 5
BSD partitions, but instead create a new DOS partition (mfid0s2 as
previously discussed above). However, if you *really* want to grow an
existing BSD partition, this can be done (very carefully).



I'm all for taking the easy way out. :-)



First, you'll want to save the output of disklabel -r mfid0s1 to a text
file.

Next, you'll have to re-fdisk mfid0 so that the first slice covers the
entire disk. Of course, re-mastering the slices does not affect the data,
but it _will_ wipe out the BSD partition map (the disklabels; in other
words, after 

RE: How to add unused space to an existing install

2013-02-07 Thread Teske, Devin

On 7 Feb 2013, Paul Schmehl wrote:
 
 --On February 6, 2013 5:21:39 PM -0600 dte...@freebsd.org wrote:
 
 
 
  -Original Message-
  From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
  questi...@freebsd.org] On Behalf Of Paul Schmehl
  Sent: Wednesday, February 06, 2013 9:59 AM
  To: FreeBSD Questions List
  Subject: How to add unused space to an existing install
 
  I have a FreeBSD 8.3 RELEASE box that we recently discovered only has
  part of the disk being used.  This box has four 1TB drives in RAID 5,
  and df only shows 500MB of disk available.
 
  fdisk shows this:
  # fdisk -p
  # /dev/mfid0
  g c364602 h255 s63
  p 1 0xa5 63 1562363771
  a 1
 
  When I run the fdisk editor in sysinstall I see this:
 
  Disk name:  mfid0  FDISK Partition
  Editor
  DISK Geometry:  364602 cyls/255 heads/63 sectors = 5857331130 sectors
  (2860024MB)
 
  Offset   Size(ST)End Name  PType   Desc  Subtype
  Flags
 
   0 63 62- 12 unused0
  63 1562363771 1562363833  mfid0s1  8freebsd  165
  1562363834 4294981702 5857345535- 12 unused0
 
  I want to capture all that unused space and add it to the server.
 
  fstab has this:
  # cat /etc/fstab
  # Device Mountpoint  FStype  Options Dump
   Pass#
  /dev/mfid0s1bnoneswapsw  0 
0
  /dev/mfid0s1a/   ufs rw  1 
1
  /dev/mfid0s1e/home   ufs rw  2 
2
  /dev/mfid0s1d/tmpufs rw  2 
2
  /dev/mfid0s1f/usrufs rw  2 
2
  /dev/mfid0s1g/varufs rw  2 
2
  /dev/acd0/cdrom  cd9660  ro,noauto   0   0
 
  When I try to create a new slice using fdisk, it doesn't seem to work.
 
  Did you try something like:
 
  echo p 2 165 * * | sudo fdisk -f- /dev/mfid0
 
  ??
 
 Thank you for your detailed and informative answer.
 
 I did not.  I'm a neophyte in the disk world.  I've always used sysinstall
 to setup partitions and mount points.
 
 
  Afterward fdisk -p should show something like...
 
 # /dev/mfid0
  g c364602 h255 s63
  p 1 0xa5 63 1562363771
  p 2 0xa5 num num
  a 1
 
  And then you'll have /dev/mfid0s2 which you can do-with what you like
  (directly newfs the slice or create BSD partitions underneath that to
  further sub-divide into as many as 8 smaller units, /dev/mfid0s2[a-h]).
 
 
 I've been doing some more research on this problem, and I've discovered
 that bsdlabel has a 2 to the 32nd limit on disk size.  It appears I have to
 use gpart instead.  Is that not correct?
 

Only if your disk is larger than 2TB (or 2048GB). If you try to partition a 
2TB disk with fdisk the most you can hope to access is 2TB (the rest will be 
forever unused).

I was noticing that that the total size for all your partitions is about 
744.95GB -- far short of the maximum addressable of 2TB. So you *could* gain 
access to more space with the tricks discussed here, but yes...

You will be required to use gpart to address more than 2TB of storage on a 
single discrete disk. gpart creates a GPT layout versus fdisk which creates an 
MBR layout. GPT uses length identifiers double that of MBR so you should be 
able to address up to 16 million terabytes on any single discrete disk with 
gpart. That ought to be enough for a while (the largest storage array known to 
exist today is in the Petabytes ... thousands of terabytes -- nobody has yet 
produced a single storage device of contiguous addressable space 
matching-or-exceeding 1024 petabytes or 1M terabytes; so we have a ways to go 
before anybody reaches the limit of 2^64).


 
  If I move to the label editor, I get this:
 
   FreeBSD Disklabel Editor
 
  Disk: mfid0 Partition name: mfid0s1 Free: 0 blocks (0MB)
 
  Part  Mount  Size Newfs   Part  Mount  Size Newfs
    -   -     -   -
  mfid0s1a  none   2000MB *
  mfid0s1d  none  65536MB *
  mfid0s1e  none   4096MB *
  mfid0s1b  swap65536MB SWAP
  mfid0s1f  none  10240MB *
  mfid0s1g  none601GB *
 
  As you can see mfid0s1g is 601GB, and according to fstab that's /var.
 
  Yet df -h shows:
 
  # df -h
  Filesystem   SizeUsed   Avail Capacity  Mounted on
  /dev/mfid0s1a1.9G726M1.0G41%/
  devfs1.0k1.0k  0B   100%/dev
  /dev/mfid0s1e3.9G 38M3.5G 1%/home
  /dev/mfid0s1d 62G6.6M 57G 0%/tmp
  /dev/mfid0s1f9.7G7.5G1.4G84%/usr
  /dev/mfid0s1g582G 39G496G 7%/var
 
  So apparently I'm not creating this new slice?  It should be
  /dev/mfid0s1h, correct?
 

RE: How to add unused space to an existing install

2013-02-07 Thread Warren Block

On Thu, 7 Feb 2013, Teske, Devin wrote:

On 7 Feb 2013, Paul Schmehl wrote:

I've been doing some more research on this problem, and I've discovered
that bsdlabel has a 2 to the 32nd limit on disk size.  It appears I have to
use gpart instead.  Is that not correct?



Only if your disk is larger than 2TB (or 2048GB). If you try to partition a 
2TB disk with fdisk the most you can hope to access is 2TB (the rest will be 
forever unused).

I was noticing that that the total size for all your partitions is about 
744.95GB -- far short of the maximum addressable of 2TB. So you *could* gain 
access to more space with the tricks discussed here, but yes...

You will be required to use gpart to address more than 2TB of storage on a 
single discrete disk. gpart creates a GPT layout versus fdisk which creates an 
MBR layout. GPT uses length identifiers double that of MBR so you should be 
able to address up to 16 million terabytes on any single discrete disk with 
gpart. That ought to be enough for a while (the largest storage array known to 
exist today is in the Petabytes ... thousands of terabytes -- nobody has yet 
produced a single storage device of contiguous addressable space 
matching-or-exceeding 1024 petabytes or 1M terabytes; so we have a ways to go 
before anybody reaches the limit of 2^64).


To be exact: fdisk can only deal with MBR partitioning.  bsdlabel only 
deals with FreeBSD partitions.  Both align partitions to CHS values, 
which don't apply to disks made in the last couple of decades.  This 
means that partitions created by these two tools will almost certainly 
be misaligned when created on an Advanced Format (4K) hard drive or an 
SSD.


gpart(8) can do GPT *and* MBR *and* bsdlabel and other partition 
schemes.  It does all the things that fdisk and bsdlabel do, and more.


For examples of creating both GPT and MBR/bsdlabel partitioning with 
gpart: http://www.wonkity.com/~wblock/docs/html/disksetup.html

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to add unused space to an existing install

2013-02-06 Thread Polytropon
On Wed, 06 Feb 2013 11:58:56 -0600, Paul Schmehl wrote:
 When I try to create a new slice using fdisk, it doesn't seem to work.  If 
 I move to the label editor, I get this:
 
  FreeBSD Disklabel Editor
 
 Disk: mfid0 Partition name: mfid0s1 Free: 0 blocks (0MB)
 
 Part  Mount  Size Newfs   Part  Mount  Size Newfs
   -   -     -   -
 mfid0s1a  none   2000MB *
 mfid0s1d  none  65536MB *
 mfid0s1e  none   4096MB *
 mfid0s1b  swap65536MB SWAP
 mfid0s1f  none  10240MB *
 mfid0s1g  none601GB *
 
 As you can see mfid0s1g is 601GB, and according to fstab that's /var.
 
 Yet df -h shows:
 
 # df -h
 Filesystem   SizeUsed   Avail Capacity  Mounted on
 /dev/mfid0s1a1.9G726M1.0G41%/
 devfs1.0k1.0k  0B   100%/dev
 /dev/mfid0s1e3.9G 38M3.5G 1%/home
 /dev/mfid0s1d 62G6.6M 57G 0%/tmp
 /dev/mfid0s1f9.7G7.5G1.4G84%/usr
 /dev/mfid0s1g582G 39G496G 7%/var
 
 So apparently I'm not creating this new slice?  It should be /dev/mfid0s1h, 
 correct?

If you're creating a new slice, that would be mfid0s2, because
mfid0s1 is the 1st slice (DOS primary partition) carrying the
partitions a, swap, d, e, f, g. If I remember correctly, h is
the last partition letter that can be assigned, so this one
should be available.

Problem: The 1st slice mfid0s1 is already of fixed size, so
you cannot add a new partition here without growint that
slice first. Attention, that step isn't free of danger and
should be done with a backup at hand, just in case, and
because you _always_ need a backup. :-)

This problem is not a problem if you create a 2nd slice
mfid0s2 to use it separately.

If you can _really_ create mfid0s2 as a slice, you only need
to format it, e. g. newfs -U /dev/mfid0s2 which creates
mfid0s2c which in turn is called mfid0s2). You can then assign
that new partition (the one covering the whole slice) to
a new mountpoint, e. g. /data, /stuff or whatever you want.
There are also means to merge this partition into some
mountpoint that is already occupied, e. g. /home, maybe via
mount -o union including all possibly negative consequences).



 How to I recapture the remaining 2+TB of space that's not being used?

Without wiping the whole disk(s)?



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to add unused space to an existing install

2013-02-06 Thread Warren Block

On Wed, 6 Feb 2013, Polytropon wrote:

On Wed, 06 Feb 2013 11:58:56 -0600, Paul Schmehl wrote:

When I try to create a new slice using fdisk, it doesn't seem to work.  If
I move to the label editor, I get this:

 FreeBSD Disklabel Editor

Disk: mfid0 Partition name: mfid0s1 Free: 0 blocks (0MB)

Part  Mount  Size Newfs   Part  Mount  Size Newfs
  -   -     -   -
mfid0s1a  none   2000MB *
mfid0s1d  none  65536MB *
mfid0s1e  none   4096MB *
mfid0s1b  swap65536MB SWAP
mfid0s1f  none  10240MB *
mfid0s1g  none601GB *

As you can see mfid0s1g is 601GB, and according to fstab that's /var.

Yet df -h shows:

# df -h
Filesystem   SizeUsed   Avail Capacity  Mounted on
/dev/mfid0s1a1.9G726M1.0G41%/
devfs1.0k1.0k  0B   100%/dev
/dev/mfid0s1e3.9G 38M3.5G 1%/home
/dev/mfid0s1d 62G6.6M 57G 0%/tmp
/dev/mfid0s1f9.7G7.5G1.4G84%/usr
/dev/mfid0s1g582G 39G496G 7%/var

So apparently I'm not creating this new slice?  It should be /dev/mfid0s1h,
correct?


If you're creating a new slice, that would be mfid0s2, because
mfid0s1 is the 1st slice (DOS primary partition) carrying the
partitions a, swap, d, e, f, g. If I remember correctly, h is
the last partition letter that can be assigned, so this one
should be available.

Problem: The 1st slice mfid0s1 is already of fixed size, so
you cannot add a new partition here without growint that
slice first. Attention, that step isn't free of danger and
should be done with a backup at hand, just in case, and
because you _always_ need a backup. :-)

This problem is not a problem if you create a 2nd slice
mfid0s2 to use it separately.

If you can _really_ create mfid0s2 as a slice, you only need
to format it, e. g. newfs -U /dev/mfid0s2 which creates
mfid0s2c which in turn is called mfid0s2). You can then assign
that new partition (the one covering the whole slice) to
a new mountpoint, e. g. /data, /stuff or whatever you want.


Yes, but creating FreeBSD partitions inside that slice allows them to be 
aligned.  That may not be a problem on these 1T drives, some 1T drives 
have 512-byte blocks.  Or the slow misaligned speed might be disguised 
by the slow RAID5 speed...


fdisk and bsdlabel always align to fictional CHS values.  gpart can 
align FreeBSD partitions.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: How to add unused space to an existing install

2013-02-06 Thread dteske


 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Paul Schmehl
 Sent: Wednesday, February 06, 2013 9:59 AM
 To: FreeBSD Questions List
 Subject: How to add unused space to an existing install
 
 I have a FreeBSD 8.3 RELEASE box that we recently discovered only has part
 of the disk being used.  This box has four 1TB drives in RAID 5, and df
 only shows 500MB of disk available.
 
 fdisk shows this:
 # fdisk -p
 # /dev/mfid0
 g c364602 h255 s63
 p 1 0xa5 63 1562363771
 a 1
 
 When I run the fdisk editor in sysinstall I see this:
 
 Disk name:  mfid0  FDISK Partition
 Editor
 DISK Geometry:  364602 cyls/255 heads/63 sectors = 5857331130 sectors
 (2860024MB)
 
 Offset   Size(ST)End Name  PType   Desc  Subtype
 Flags
 
  0 63 62- 12 unused0
 63 1562363771 1562363833  mfid0s1  8freebsd  165
 1562363834 4294981702 5857345535- 12 unused0
 
 I want to capture all that unused space and add it to the server.
 
 fstab has this:
 # cat /etc/fstab
 # Device  Mountpoint  FStype  Options Dump
   Pass#
 /dev/mfid0s1b noneswapsw  0   0
 /dev/mfid0s1a /   ufs rw  1   1
 /dev/mfid0s1e /home   ufs rw  2   2
 /dev/mfid0s1d /tmpufs rw  2   2
 /dev/mfid0s1f /usrufs rw  2   2
 /dev/mfid0s1g /varufs rw  2   2
 /dev/acd0 /cdrom  cd9660  ro,noauto   0   0
 
 When I try to create a new slice using fdisk, it doesn't seem to work.

Did you try something like:

echo p 2 165 * * | sudo fdisk -f- /dev/mfid0

??

Afterward fdisk -p should show something like...

# /dev/mfid0
g c364602 h255 s63
p 1 0xa5 63 1562363771
p 2 0xa5 num num
a 1

And then you'll have /dev/mfid0s2 which you can do-with what you like (directly
newfs the slice or create BSD partitions underneath that to further sub-divide
into as many as 8 smaller units, /dev/mfid0s2[a-h]).


 If I move to the label editor, I get this:
 
  FreeBSD Disklabel Editor
 
 Disk: mfid0 Partition name: mfid0s1 Free: 0 blocks (0MB)
 
 Part  Mount  Size Newfs   Part  Mount  Size Newfs
   -   -     -   -
 mfid0s1a  none   2000MB *
 mfid0s1d  none  65536MB *
 mfid0s1e  none   4096MB *
 mfid0s1b  swap65536MB SWAP
 mfid0s1f  none  10240MB *
 mfid0s1g  none601GB *
 
 As you can see mfid0s1g is 601GB, and according to fstab that's /var.
 
 Yet df -h shows:
 
 # df -h
 Filesystem   SizeUsed   Avail Capacity  Mounted on
 /dev/mfid0s1a1.9G726M1.0G41%/
 devfs1.0k1.0k  0B   100%/dev
 /dev/mfid0s1e3.9G 38M3.5G 1%/home
 /dev/mfid0s1d 62G6.6M 57G 0%/tmp
 /dev/mfid0s1f9.7G7.5G1.4G84%/usr
 /dev/mfid0s1g582G 39G496G 7%/var
 
 So apparently I'm not creating this new slice?  It should be /dev/mfid0s1h,
 correct?
 

Let's not confuse slices (DOS partitions) with disklabels (BSD partitions).

DOS partitions are (maximum 4 per disk):

mfid0s1
mfid0s2
mfid0s3
mfid0s4

(according to your fdisk -p output, you're mfid0 disk is currently only using
mfid0s1)

BSD partitions are (maximum 8 per slice aka DOS partition):

mfid0s1a
mfid0s1b
mfid0s1c
mfid0s1d
mfid0s1e
mfid0s1f
mfid0s1g
mfid0s1h

(according to your sysinstall output, you're mfid0s1 slice has 5 BSD partitions
-- a, e, d, f, and g)


 How to I recapture the remaining 2+TB of space that's not being used?
 

The easiest way to use your extra space is to not adjust one of those 5 BSD
partitions, but instead create a new DOS partition (mfid0s2 as previously
discussed above). However, if you *really* want to grow an existing BSD
partition, this can be done (very carefully).

First, you'll want to save the output of disklabel -r mfid0s1 to a text file.

Next, you'll have to re-fdisk mfid0 so that the first slice covers the entire
disk. Of course, re-mastering the slices does not affect the data, but it _will_
wipe out the BSD partition map (the disklabels; in other words, after using
fdisk to adjust the slice size of the first DOS partition, disklabel -r
mfid0s1 will no longer return what it had before -- you'll have no disklabels
after), so the previous step of backing up the output of disklabel -r ... is
paramount.

Next, you'll have to restore the disklabel (using disklabel -e mfid0s1 and
cross-referencing your backup text file) with one slight adjustment...

You're going to use the *exact* values you backed up _EXCEPT_ you're going to
make the last label (position-wise -- taking care to note the byte ranges