Disk extend

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Disk extend

Gokan Atmaca
Hello

I use KVM. I upgraded to a single disk that was owned by Freebsd with
Qemu. But the disk "ROOT" is still small. What should I do for it ?

root@test:~ # gpart show ada0
=> 34 83886013 ada0 GPT (40G)
34 1024 1 freebsd-boot (512K)
1058 39844864 2 freebsd-ufs (19G)
39845922 2097084 3 freebsd-swap (1.0G)
41943006 41943041 - free - (20G)

I did so;
root@test:~ # gpart resize -i 2 -s 20971520 ada0
gpart: Device busy

How can I do this safely?
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-user-groups
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Disk extend

Jan Bramkamp-2
On 21/01/2017 16:01, Gokan Atmaca wrote:

> Hello
>
> I use KVM. I upgraded to a single disk that was owned by Freebsd with
> Qemu. But the disk "ROOT" is still small. What should I do for it ?
>
> root@test:~ # gpart show ada0
> => 34 83886013 ada0 GPT (40G)
> 34 1024 1 freebsd-boot (512K)
> 1058 39844864 2 freebsd-ufs (19G)
> 39845922 2097084 3 freebsd-swap (1.0G)
> 41943006 41943041 - free - (20G)
>
> I did so;
> root@test:~ # gpart resize -i 2 -s 20971520 ada0
> gpart: Device busy
>
> How can I do this safely?
You can't expand a partition unless there is free space directly behind
it. In your case the swap partition is in the way. You can disable swap,
delete the swap partition, resize the root partition to the right size
(in your case 19GB+20GB = 29GB) leaving space for a new swap partition
(in your case 1GB). It would look something like this:

# Disable swap
swapoff -a

# Delete the third partition
gpart delete -i 3                     ada0

# Resize the second partition now that there is adjacent free space
gpart resize -i 2 -s 29G              ada0

# Recreate the swap partition
gpart add    -t freebsd-swap -l swap0 ada0

# Enable swap
swapon -a

Now the UFS file system is smaller than the containing partition. Use
growfs(8) to resize your file system.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-user-groups
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Disk extend

Gokan Atmaca
> You can't expand a partition unless there is free space directly behind it.
> In your case the swap partition is in the way. You can disable swap, delete
> the swap partition, resize the root partition to the right size (in your
> case 19GB+20GB = 29GB) leaving space for a new swap partition (in your case
> 1GB). It would look something like this:

Can we do online ?

Thanks.

On Mon, Jan 23, 2017 at 3:53 PM, Jan Bramkamp <[hidden email]> wrote:

> On 21/01/2017 16:01, Gokan Atmaca wrote:
>>
>> Hello
>>
>> I use KVM. I upgraded to a single disk that was owned by Freebsd with
>> Qemu. But the disk "ROOT" is still small. What should I do for it ?
>>
>> root@test:~ # gpart show ada0
>> => 34 83886013 ada0 GPT (40G)
>> 34 1024 1 freebsd-boot (512K)
>> 1058 39844864 2 freebsd-ufs (19G)
>> 39845922 2097084 3 freebsd-swap (1.0G)
>> 41943006 41943041 - free - (20G)
>>
>> I did so;
>> root@test:~ # gpart resize -i 2 -s 20971520 ada0
>> gpart: Device busy
>>
>> How can I do this safely?
>
> You can't expand a partition unless there is free space directly behind it.
> In your case the swap partition is in the way. You can disable swap, delete
> the swap partition, resize the root partition to the right size (in your
> case 19GB+20GB = 29GB) leaving space for a new swap partition (in your case
> 1GB). It would look something like this:
>
> # Disable swap
> swapoff -a
>
> # Delete the third partition
> gpart delete -i 3                     ada0
>
> # Resize the second partition now that there is adjacent free space
> gpart resize -i 2 -s 29G              ada0
>
> # Recreate the swap partition
> gpart add    -t freebsd-swap -l swap0 ada0
>
> # Enable swap
> swapon -a
>
> Now the UFS file system is smaller than the containing partition. Use
> growfs(8) to resize your file system.
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-user-groups
> To unsubscribe, send any mail to
> "[hidden email]"
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-user-groups
To unsubscribe, send any mail to "[hidden email]"