I have a 4 GB SD card. Before the image loadroot@ubuntu# fdisk -lDisk /dev/sdb: 3965 MB, 3965190144 bytes49 heads, 48 sectors/track, 3292 cylinders, total 7744512 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000   Device Boot      Start         End      Blocks   Id  System/dev/sdb1            8192     7744511     3868160    b  W95 FAT32I loaded a 2gb SD image to the card by dd if=2gbsd-noeclipse-latest.dd of=/dev/sdb bs=4M conv=fsync. The fdisk -l outputs:root@ubuntu# fdisk -lDisk /dev/sdb: 3965 MB, 3965190144 bytes122 heads, 62 sectors/track, 1023 cylinders, total 7744512 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000   Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1       16063        8031+   b  W95 FAT32/dev/sdb2           16064       20158        2047+  da  Non-FS data/dev/sdb3           20162       24257        2048   da  Non-FS data/dev/sdb4           24260     3678207     1826974   83  Linuxso I have 2GB that is not used. I want to extend sdb4 so that I can use the 2GB space that is not included.So I calculate the unused space as (7744512-3678207)*512= 2081948160 byte and 2081948160 / 1048576 = 1985.50048828 MB. So roughly I will extend 1900 MB. I use resize2fs to do that:resize2fs /dev/sdb4 1900MHowever, it outputs resize2fs 1.42.5 (29-Jul-2012)open: No such file or directory while opening /dev/sdb4Could anyone tell me how I should use the command above or how else I can extend the sdb4?
extending a partition by resize2fs
linux;partition;storage;sd card;resize2fs
You must tell apart the resizing of a block device (here: /dev/sdb4) from the resizing of a file system. A file system can be smaller but not bigger than the underlying block device.You should make a backup of the partition table:sfdisk -d /dev/sdb > ~/sfdisk_sdb.txtThen you make a copy of that file and adapt the line that looks similar to this:/dev/sdb4 : start=24260, size=3653948, Id= 83You want that partition to end on the last sector of the device (i.e. 7744511; the first one is 0 not 1). The size is this number minus the start sector plus one (both the start and end sector count). Then you replace the partition table:sfdisk /dev/sdb <~/sfdisk_sdb.mod.txtAfter that you can use resize2fs without a size parameter. It will use the whole size of /dev/sdb4 then. You must run e2fsck -f /dev/sdb4 immediately before using resize2fs.