How to expand the file system manually?

I’ve been running Owncloud and it was extremely easy to setup through dietpi. I’m expanding my storage to a 128g card (currently on a 32g) So I ripped my SD card image to transfer on the new card. My problem is I don’t seem the ability to expand the file system like in the raspi-config script on a stock image of raspbian. I was wondering how to expand the file system using dietpi?

Manual like:

root@OrangePi-ONE:~# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/mmcblk0: 7,4 GiB, 7969177600 bytes, 15564800 sectors
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: 0x0000b6e5

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   133119   131072   64M  e W95 FAT16 (LBA)
/dev/mmcblk0p2      133120 15564799 15431680  7,4G 83 Linux

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): p
Partition number (2-4, default 2): 2
First sector (133120-15564799, default 133120):
Last sector, +sectors or +size{K,M,G,T,P} (133120-15564799, default 15564799):

Created a new partition 2 of type 'Linux' and of size 7,4 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Das Gerät oder die Ressource ist belegt

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@OrangePi-ONE:~# partprobe

root@OrangePi-ONE:~# resize2fs /dev/mmcblk0p2
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 1928960 (4k) blocks long.  Nothing to do!


Thanks for that, is there any script available within diet-pi that simplifys the process?

Yes, but why? You ask for manual resize…

… but it only run once at first boot up and it is the same.

Have you tried to do it manually?

Hello Everyone,

I know this post is old but I will reply anyway. Isn’t that method going to wipe out existing data as opposed to keeping the data and expanding the drive size? I am just asking because I am not the best at doing drive exapansion in linux.

Thanks Guys,

Did you checked the resizing feature which can be found in dietpi-drive_manager?

1 Like

Indeed dietpi-drive_manager (with r at the end) does the job. Select your partition → Resize.