gpart resize problem

Michael W. Lucas mwlucas at michaelwlucas.com
Thu Jul 24 02:19:52 UTC 2014


Hi,

I am utterly perplexed by how gpart resize behaves, and beseech you
for enlightenment. I'm running:

# uname -a
FreeBSD storm 11.0-CURRENT FreeBSD 11.0-CURRENT #6 r269010: Wed Jul 23 11:13:17 EDT 2014     mwlucas at storm:/usr/obj/usr/src/sys/GENERIC  amd64

I have empty space on disk da0, right next to partition 6.

# gpart show da0
=>        40  1953525088  da0  GPT  (932G)
          40        1024    1  freebsd-boot  (512K)
        1064         984       - free -  (492K)
        2048    16777216    2  freebsd-swap  (8.0G)
    16779264    10485760    3  freebsd-ufs  (5.0G)
    27265024    10485760    4  freebsd-ufs  (5.0G)
    37750784   104857600       - free -  (50G)
   142608384  1810916744    6  freebsd-ufs  (864G)

I want to expand partition 6.

# gpart resize -i 6 -a 4k da0
da0p6 resized
# gpart show da0
=>        40  1953525088  da0  GPT  (932G)
          40        1024    1  freebsd-boot  (512K)
        1064         984       - free -  (492K)
        2048    16777216    2  freebsd-swap  (8.0G)
    16779264    10485760    3  freebsd-ufs  (5.0G)
    27265024    10485760    4  freebsd-ufs  (5.0G)
    37750784   104857600       - free -  (50G)
   142608384  1810916744    6  freebsd-ufs  (864G)

That's really weird. Maybe I can't expand a partition backwards?

# gpart resize -i 4 -a 4k -s 10G da0
da0p4 resized
# gpart show da0
=>        40  1953525088  da0  GPT  (932G)
          40        1024    1  freebsd-boot  (512K)
        1064         984       - free -  (492K)
        2048    16777216    2  freebsd-swap  (8.0G)
    16779264    10485760    3  freebsd-ufs  (5.0G)
    27265024   115343360    4  freebsd-ufs  (55G)
   142608384  1810916744    6  freebsd-ufs  (864G)

Wait! I said 10G, not 55G!

Can I shrink this partition back down?

# gpart resize -i 4 -a 4k -s 5G da0
da0p4 resized
# gpart show da0
=>        40  1953525088  da0  GPT  (932G)
          40        1024    1  freebsd-boot  (512K)
        1064         984       - free -  (492K)
        2048    16777216    2  freebsd-swap  (8.0G)
    16779264    10485760    3  freebsd-ufs  (5.0G)
    27265024    10485760    4  freebsd-ufs  (5.0G)
    37750784   104857600       - free -  (50G)
   142608384  1810916744    6  freebsd-ufs  (864G)

Yes, I can make it return to 5G.

Trying to make da0p4 grow by only a few GB makes the partition pop up
to 55GB. I can then shrink it to the desired size with a second
change.

Am I totally misunderstanding "gpart resize"?

Thanks,
==ml

-- 
Michael W. Lucas  -  mwlucas at michaelwlucas.com, Twitter @mwlauthor 
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/


More information about the freebsd-questions mailing list