[SOLVED] How to resize GPT disk ?
Hello again everyone,
First, I apologize, because possible to use raw disk for ZFS.
However, this option I do not like, so I got my way
Experiment
1. They made volumeset, watch the size of
Code:
# Ñamcontrol readcap da1-h
Device Size: 954 M, Block Length: 512 bytes
2. Make the scheme
Code:
# gpart create -s gpt da1
da1 created
3. Made partitions
Code:
# gpart add -t freebsd-zfs da1
da1p1 added
4. Look what happened
Code:
# gpart show da1
=> 34 1952701 da1 GPT (954M)
34 1952701 1 freebsd-zfs (953M)
5. Making zpool
Code:
#zpool create test da1p1
# df -h test
Filesystem Size Used Avail Capacity Mounted on
test 912M 18K 912M 0% /test
6. Filling drive
Code:
# time dd if=/dev/urandom of=/test2/dump bs=1m
dd: /test2/dump: No space left on device
912+0 records in
911+1 records out
955383808 bytes transferred in 22.368060 secs (42711965 bytes/sec)
dd if=/dev/urandom of=/test2/dump bs=1m 0.00s user 19.99s system 89% cpu 22.370 total
# df -h /test
Filesystem Size Used Avail Capacity Mounted on
test 912M 912M 0B 100% /test
7. Hash
Code:
# md5 /test2/dump
MD5 (/test2/dump) = e9cfb1762976345d87155d99c14319c0
8. Pushes the boundaries
Code:
areca-cli
CLI> vsf info
# Name Raid Name Level Capacity Ch/Id/Lun State
===============================================================================
1 ARC-1220-VOL#00 Raid Set # 00 Raid0 1.0GB 00/00/01 Normal
2 ST380817AS Raid Set # 01 PassThr 80.0GB 00/00/00 Normal
===============================================================================
GuiErrMsg<0x00>: Success.
CLI> set password=0000
GuiErrMsg<0x00>: Success.
CLI> vsf modify vol=1 capacity=2
GuiErrMsg<0x00>: Success.
CLI> vsf info
# Name Raid Name Level Capacity Ch/Id/Lun State
===============================================================================
1 ARC-1220-VOL#00 Raid Set # 00 Raid0 2.0GB 00/00/01 Normal
2 ST380817AS Raid Set # 01 PassThr 80.0GB 00/00/00 Normal
===============================================================================
GuiErrMsg<0x00>: Success.
# camcontrol readcap da1 -h
Device Size: 1.9 G, Block Length: 512 bytes
9. Look what happened
Code:
# gpart show da1
=> 34 1952701 da1 GPT (954M)
34 1952701 1 freebsd-zfs (953M)
10. Now you have that would freebsd determined that there is free space.
If a reboot or do any transactions with any drive, the system still recognizes that the disk has changed. In the first experiment was enough for me "rescan", in the second and had to reboot
(I should think).
Code:
# camcontrol rescan all
Re-scan of bus 0 was successful
zavhoz# gpart show da1
=> 34 1952701 da1 GPT (1.9G)
34 1952701 1 freebsd-zfs (953M)
11. Install sysutils/gdisk
On amd64 Edit the Makefile. The port is marked as working only on i386, but it is not.
12. Unmount pool
The trouble is that while a pool online with markings do nothing.
Hurry, and in the hope that the pool will be restored killed him.
But destroy - that destroy ... The correct command is:
Code:
# zpool export test2
# zpool status
no pools available
13. Edit the GPT (if briefly press v, x, e, w, y)
Code:
# gdisk /dev/da1
GPT fdisk (gdisk) version 0.6.9
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): v
Problem: The secondary header's self-pointer indicates that it doesn't reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.
Identified 1 problems!
Command (? for help): x
Expert command (? for help): e
Relocating backup data structures to the end of the disk
Expert command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed, possibly destroying your data? (Y/N): y
OK; writing new GUID partition table (GPT).
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
14. Look what happened
Code:
# gpart show da1
=> 34 3905981 da1 GPT (1.9G)
34 1952701 1 freebsd-zfs (953M)
1952735 1953280 - free - (954M)
15. Resize partition
Code:
# gpart resize -i 1 da1
da1p1 resized
16. Again, look what happened.
Code:
# gpart show da1
=> 34 3905981 da1 GPT (1.9G)
34 3905981 1 freebsd-zfs (1.9G)
17. mount pool
Code:
zavhoz# zpool import
pool: test2
id: 12254915794173548567
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
test2 ONLINE
da1p1 ONLINE
zavhoz# zpool import test2
18. Check
Code:
# ls /test2
dump
# df -h /test2
Filesystem Size Used Avail Capacity Mounted on
test2 1.8G 912M 952M 49% /test2
# md5 /test2/dump
MD5 (/test2/dump) = e9cfb1762976345d87155d99c14319c0
It came!
P.S. I do not know how to change the status of the topic at - resolved.