tomuta / debian-mini-odroid-c1

Script to build a minimal Debian sd card image.
75 stars 39 forks source link

How to resize the partition? #25

Closed dniku closed 9 years ago

dniku commented 9 years ago

(Almost) right after installation on a 16Gb microSD card, this is what my partition table looks like:

# fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x0000de21

Device         Boot Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *     2048   80324   78277 38.2M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      80325 2040254 1959930  957M 83 Linux

Which, translated into human units, means that I don't have much storage available:

# df -h 
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       926M  773M  128M  86% /
devtmpfs        407M     0  407M   0% /dev
tmpfs           411M     0  411M   0% /dev/shm
tmpfs           411M   12M  399M   3% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           411M     0  411M   0% /sys/fs/cgroup
tmpfs           411M     0  411M   0% /tmp
/dev/mmcblk0p1   38M   24M   15M  63% /boot

The way odroid-utility.sh resizes the partition won't work with this setup, since they remove /dev/mmcblk0p2 and create a new one in its place, while this installation mounts that partition on /:

# mount | grep mmc
/dev/mmcblk0p2 on / type ext4 (rw,noatime,nodiratime,errors=remount-ro,stripe=16384,data=ordered)
/dev/mmcblk0p1 on /boot type vfat (ro,nosuid,nodev,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,flush,errors=remount-ro)

So is there any way to resize /dev/mmcblk0p2 from within Debian?

dniku commented 9 years ago

I have made a mistake thinking that the data is not preserved while deleting a partition with fdisk and creating a new one. This is not the case. I can just follow the steps in the official resize script and everything works. Closing the issue.