Resizing GPT partitions
Stephane Dupille
stephane at dupille.org
Tue Jun 8 17:14:17 UTC 2010
Hello,
I installed a FreeBSD 8.0-RELEASE into a virtual machine (with virtual
box), using a GTP partitioning scheme, and zfs. The virtual disk disk
is 10 Go.
I dumped this disk image to a real machine, which has a 160 Go disk.
The system works fine, but I can only use 10 Go of disk space. How can
I gain more space ?
How can I enlarge the last partition of the disk to use the whole disk ?
I tried to create a new partition on the disk, and planned to add it
in the zfs pool, but that didn't work :
# gpart add -t freebsd-zfs -l disk0f ad0
gpart: autofill: No space left on device
That's odd, because it seems that gpart is aware of the new geometry.
What's the problem ?
Some info :
# gpart list
Geom name: ad0
fwheads: 16
fwsectors: 63
last: 20971486
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ad0p1
Mediasize: 65536 (64K)
Sectorsize: 512
Mode: r0w0e0
rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
label: (null)
length: 65536
offset: 17408
type: freebsd-boot
index: 1
end: 161
start: 34
2. Name: ad0p2
Mediasize: 4294967296 (4.0G)
Sectorsize: 512
Mode: r1w1e1
rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
label: swap0
length: 4294967296
offset: 82944
type: freebsd-swap
index: 2
end: 8388769
start: 162
3. Name: ad0p3
Mediasize: 6442351104 (6.0G)
Sectorsize: 512
Mode: r1w1e2
rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
label: disk0
length: 6442351104
offset: 4295050240
type: freebsd-zfs
index: 3
end: 20971486
start: 8388770
Consumers:
1. Name: ad0
Mediasize: 160041885696 (149G)
Sectorsize: 512
# fdisk ad0
******* Working on device /dev/ad0 *******
parameters extracted from in-core disklabel are:
cylinders=310101 heads=16 sectors/track=63 (1008 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=310101 heads=16 sectors/track=63 (1008 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 20971487, size 291610321 (142387 Meg), flag 80 (active)
beg: cyl 1023/ head 255/ sector 63;
end: cyl 1023/ head 80/ sector 63
The data for partition 2 is:
sysid 0 (0000),(unused)
start 162, size 8388608 (4096 Meg), flag 0
beg: cyl 0/ head 2/ sector 37;
end: cyl 522/ head 45/ sector 5
The data for partition 3 is:
sysid 0 (0000),(unused)
start 8388770, size 12582717 (6143 Meg), flag 0
beg: cyl 522/ head 45/ sector 6;
end: cyl 1023/ head 105/ sector 47
The data for partition 4 is:
<UNUSED>
More information about the freebsd-stable
mailing list