Extend hard disk error "Failed to remove partition"

Ive follow that link: How to extend ownCloud storage - Apps & App Center - Univention Help

Presently my Hard drive is 150 GB and would like to extend it to 200 GB

here is the step ive done

root@cloud: ~root@cloud:~# fdisk -l
[1mDisk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
[0mDisk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdb5c5a02

[1mDevice[0m[1mBoot[0m[1m Start[0m[1m End[0m[1m Sectors[0m[1m Size[0m[1mId[0m[1mType[0m
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 104855551 103854082 49.5G 5 Extended
/dev/sda3 104855552 209715199 104859648 50G 8e Linux LVM
/dev/sda4 209715200 314572799 104857600 50G 8e Linux LVM
/dev/sda5 1001472 104855551 103854080 49.5G 8e Linux LVM

Partition table entries are not in disk order.

[1mDisk /dev/mapper/vg_ucs-root: 147.5 GiB, 158393696256 bytes, 309362688 sectors
[0mUnits: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[1mDisk /dev/mapper/vg_ucs-swap_1: 2 GiB, 2147483648 bytes, 4194304 sectors
[0mUnits: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
]0;root@cloud: ~root@cloud:~# clear
[H[2J[3J]0;root@cloud: ~root@cloud:~# fdisk /dev/sda
[32m
Welcome to fdisk (util-linux 2.33.1).
[0mChanges will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
[1mDisk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
[0mDisk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdb5c5a02

[1mDevice[0m [1mBoot[0m[1m Start[0m[1m End[0m[1m Sectors[0m[1m Size[0m[1mId[0m[1mType[0m
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 104855551 103854082 49.5G 5 Extended
/dev/sda3 104855552 209715199 104859648 50G 8e Linux LVM
/dev/sda4 209715200 314572799 104857600 50G 8e Linux LVM
/dev/sda5 1001472 104855551 103854080 49.5G 8e Linux LVM

Partition table entries are not in disk order.

Command (m for help): d
Partition number (1-5, default 5): 5

Partition 5 has been deleted.

Command (m for help): d
Partition number (1-4, default 4): 4

Partition 4 has been deleted.

Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 2
First sector (999424-419430399, default 999424): 1001470
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1001470-419430399, default 419430399):

Created a new partition 2 of type ‘Extended’ and of size 199.5 GiB.

Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (1003518-419430399, default 1003520):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1003520-419430399, default 419430399):

Created a new partition 5 of type ‘Linux’ and of size 199.5 GiB.
[31mPartition #5 contains a ext4 signature.[0m

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): x

Expert command (m for help): b
Partition number (1,2,5, default 5):
New beginning of data (1001471-419430399, default 1003520): 1001472

Expert command (m for help): p
[1m
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
[0mDisk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdb5c5a02

[1mDevice[0m [1mBoot[0m[1m Start[0m[1m End[0m[1m Sectors[0m[1mId[0m[1mType[0m [1mStart-C/H/S[0m[1mEnd-C/H/S[0m[1mAttrs[0m
/dev/sda1 * 2048 999423 997376 83 Linux 0/32/33 62/53/55 80
/dev/sda2 1001470 419430399 418428930 5 Extended 62/86/23 508/85/25
/dev/sda5 1001472 419430399 418428928 83 Linux 62/118/57 508/85/25

Expert command (m for help): r

Command (m for help): w
The partition table has been altered.
[31mFailed to remove partition 3 from system: Device or resource busy
[0m[31mFailed to remove partition 4 from system: Device or resource busy
[0m[31mFailed to update system information about partition 2: Device or resource busy
[0m[31mFailed to update system information about partition 5: Device or resource busy
[0m
The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.

]0;root@cloud: ~root@cloud:~# shutdown -r now

After rebooting well it don’t reboot :slight_smile: Don’t worry ive got a snapshot of the server

Is the error device or ressource is busy normal ?

Any ideas what i did wrong

Thanks !

I was able to extend my hard drive from 150GB to 450GB using gparted-live-1.6.0-3-amd64.iso downloaded from here : GParted – A free application for graphically managing disk device partitions

image0001-141333029
image0002-141402305
image0004-141501404
image0005-141525381
image0006-141544685
image0007-141628853
image0008-141659691
image0009-141821759
image0010-141840542
image0011-141913653

After ive reboot the server and did these commands so Nextcloud know that ive add 300GB and reboot the server and everything was ok

image0013-142318129
image0015-142558271

Mastodon