gpt in-place editing
Dmitry Morozovsky
marck at rinet.ru
Mon Sep 22 18:12:57 UTC 2008
On Sun, 21 Sep 2008, Stanislav Sedov wrote:
SS> > is there a way to split existing GPT partition into two, like one can do in
SS> > bsdlabel case?
SS> >
SS> > I found myself wanting to shrink swap to have an alternate root, but have no
SS> > luck in my experiments.
SS> >
SS> > For the reference, I have
SS> >
SS> > da0p1 boot
SS> > da0p2 bootdisk
SS> > da0p3 swap
SS> > da0p4 ZFS
SS> >
SS> > and want to place two partitions in place of da0p3...
SS>
SS> You can simpy remove the da0p3 partition and add two new instead of it.
It does not seem gpart wants allow me to delete da0p3 while disk is active...
gpt did the trick though, with sysctl kern.geom.debugflags=16
root at beaver:/# gpt remove -i 3 da0
da0p3 removed
root at beaver:/# gpt show da0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 128 1 GPT part - FreeBSD boot
162 1048576 2 GPT part - FreeBSD UFS/UFS2
1048738 33554432
34603170 4359862077 4 GPT part - FreeBSD ZFS
4394465247 32 Sec GPT table
4394465279 1 Sec GPT header
root at beaver:/# gpt add -s 1048576 -t ufs da0
root at beaver:/# gpt show da0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 128 1 GPT part - FreeBSD boot
162 1048576 2 GPT part - FreeBSD UFS/UFS2
1048738 1048576 3 GPT part - FreeBSD UFS/UFS2
2097314 32505856
34603170 4359862077 4 GPT part - FreeBSD ZFS
4394465247 32 Sec GPT table
4394465279 1 Sec GPT header
root at beaver:/# gpt add -t swap da0
BUT -
system missed part 5:
root at beaver:/# gpt show da0
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 128 1 GPT part - FreeBSD boot
162 1048576 2 GPT part - FreeBSD UFS/UFS2
1048738 1048576 3 GPT part - FreeBSD UFS/UFS2
2097314 32505856 5 GPT part - FreeBSD swap
34603170 4359862077 4 GPT part - FreeBSD ZFS
4394465247 32 Sec GPT table
4394465279 1 Sec GPT header
root at beaver:/# gpart show
=> 34 4394465213 da0 GPT (2.2TB)
34 128 1 freebsd-boot (65.5KB)
162 1048576 2 freebsd-ufs (536.9MB)
1048738 33554432 3 freebsd-swap (17.2GB)
34603170 4359862077 4 freebsd-zfs (2.2TB)
root at beaver:/# ls /dev/da0*
/dev/da0 /dev/da0p1 /dev/da0p2 /dev/da0p3 /dev/da0p4
Marcel, can you please comment too? Thanks.
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: marck at FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------
More information about the freebsd-fs
mailing list