rddisco
Posts: 6
Joined: Sun May 31, 2015 12:59 am
Location: London, UK

Resizing card's partition (Fedora on Pi 2)

Sun May 31, 2015 1:13 am

Dear All,

I am new and relatively inexperienced with Linux (working mostly on Pidora and CentOS, all CLI and no graphic interfaces). Can anyone help me to understand what I am doing wrong? I downloaded this Fedora image for my Pi 2 http://download.fedoraproject.org/pub/f ... sda.raw.xz , wrote it onto a 16GB card and had:

Code: Select all

[[email protected] ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.3G  713M  540M  57% /
devtmpfs        484M     0  484M   0% /dev
tmpfs           488M     0  488M   0% /dev/shm
tmpfs           488M  332K  488M   1% /run
tmpfs           488M     0  488M   0% /sys/fs/cgroup
/dev/mmcblk0p1  488M   28M  461M   6% /boot
tmpfs            98M     0   98M   0% /run/user/0
I tried to resize by creating a "headless" file with the 'RESIZE' instruction inside but when I rebooted the system the partition size was still as seen above. Next I tried to resize manually with fdisk/parted, only to be unable to reboot the system. What am I doing incorrectly?

Regards

Raul

Code: Select all

[[email protected] ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.3G  713M  540M  57% /
devtmpfs        484M     0  484M   0% /dev
tmpfs           488M     0  488M   0% /dev/shm
tmpfs           488M  332K  488M   1% /run
tmpfs           488M     0  488M   0% /sys/fs/cgroup
/dev/mmcblk0p1  488M   28M  461M   6% /boot
tmpfs            98M     0   98M   0% /run/user/0
[[email protected] ~]# 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: 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: 0xa99d2bd5

Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk0p1         2048 1001471  999424  488M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      1001472 1251327  249856  122M 83 Linux
/dev/mmcblk0p3      1251328 3985407 2734080  1.3G 83 Linux


Command (m for help): q

[[email protected] ~]# parted /dev/mmcblk0
GNU Parted 3.2
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit chs
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start      End        Type     File system     Flags
 1      0,32,32    62,86,23   primary  fat16           lba
 2      62,86,24   77,227,21  primary  linux-swap(v1)
 3      77,227,22  248,20,27  primary  ext4

(parted) rm 2
Warning: Partition /dev/mmcblk0p2 is being used. Are you sure you want to continue?
Yes/No? y
Error: Partition(s) 2 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.
As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start      End        Type     File system  Flags
 1      0,32,32    62,86,23   primary  fat16        lba
 3      77,227,22  248,20,27  primary  ext4

(parted) rm 3
Error: Partition(s) 2, 3 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in
use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start    End       Type     File system  Flags
 1      0,32,32  62,86,23  primary  fat16        lba

(parted) mkpart primary 62,86,24  1910,0,0
Error: Error informing the kernel about modifications to partition /dev/mmcblk0p2 -- Device or resource busy.  This means Linux won't know about any
changes you made to /dev/mmcblk0p2 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel? i
Error: Partition(s) 3 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.
As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start     End       Type     File system  Flags
 1      0,32,32   62,86,23  primary  fat16        lba
 2      62,86,24  1910,0,0  primary               lba

(parted) rm 2
Warning: Partition /dev/mmcblk0p2 is being used. Are you sure you want to continue?
Yes/No? y
Error: Partition(s) 2, 3 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in
use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start    End       Type     File system  Flags
 1      0,32,32  62,86,23  primary  fat16        lba

(parted) mkpart primary ext4 62,86,24  1910,0,0
Error: Error informing the kernel about modifications to partition /dev/mmcblk0p2 -- Device or resource busy.  This means Linux won't know about any
changes you made to /dev/mmcblk0p2 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel? i
Error: Partition(s) 3 on /dev/mmcblk0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.
As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? i
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start     End       Type     File system  Flags
 1      0,32,32   62,86,23  primary  fat16        lba
 2      62,86,24  1910,0,0  primary  ext4         lba

(parted) quit
Information: You may need to update /etc/fstab.

[[email protected] ~]# reboot
Running:

Two Pidora systems on Pi 1 B
One FC21 system on Pi 2 B

rddisco
Posts: 6
Joined: Sun May 31, 2015 12:59 am
Location: London, UK

Re: Resizing card's partition (Fedora on Pi 2)

Sun May 31, 2015 2:04 pm

Solved:

I was following an article (found on this forum) saying that if there is a swap partition that you don't need anymore, you can delete it. If this is correct, I believe that the article fails to explain that something else needs to be done to allow the system to work properly when the swap partition is removed. In my case I was unable to reboot.

So I left the swap partition (number 2 in the parted list), removed partition 3, recreated it to occupy the remaining available space in the card (up to about 14GB), rebooted, expanded the file system, and it all worked:

Code: Select all

[[email protected] ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        14G  1.1G   13G   8% /
devtmpfs        484M     0  484M   0% /dev
tmpfs           488M     0  488M   0% /dev/shm
tmpfs           488M  304K  488M   1% /run
tmpfs           488M     0  488M   0% /sys/fs/cgroup
/dev/mmcblk0p1  488M   42M  447M   9% /boot
tmpfs            98M     0   98M   0% /run/user/0
[[email protected] ~]# 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: 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: 0xa99d2bd5

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         2048  1001471   999424  488M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      1001472  1251327   249856  122M 83 Linux
/dev/mmcblk0p3      1251328 31116287 29864960 14.2G 83 Linux


Command (m for help): q

[[email protected] ~]# parted /dev/mmcblk0
GNU Parted 3.2
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit chs
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 1936,229,20
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1936,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags:

Number  Start      End          Type     File system     Flags
 1      0,32,32    62,86,23     primary  fat16           lba
 2      62,86,24   77,227,21    primary  linux-swap(v1)
 3      77,227,22  1936,229,20  primary  ext4

(parted) quit
[[email protected] ~]#
I hope this will save some headaches to others who face the same issue in the future.
Running:

Two Pidora systems on Pi 1 B
One FC21 system on Pi 2 B

Return to “Beginners”