PiShrink
PiShrink copied to clipboard
"parted: invalid token: primary Error: Expecting a file system type." 2 images
Hello@all
My Sd card from my pi are broken, with tet disk i can make 2 image.dd files from the /boot and the ext4 partion from the Card. The main card was 64gb large, now I want to reduce the size of the 64gb image file. How do I do that? A simple ./pishrink.sh -vd /mnt/f/assas/pishrink.bin does nothing.
`pishrink.sh v0.1.2
pishrink.sh: Gathering data ...
Line 296
beforesize: 60G
parted_output: BYT;
/mnt/f/assas/pishrink.bin:63591940096B:file:512:512:loop::;
1:0B:63591940095B:63591940096B:ext4::;
partnum: 1
partstart: 0
parttype: primary
tune2fs_output: tune2fs 1.45.5 (07-Jan-2020)
Filesystem volume name: rootfs
Last mounted on: /tmp/tmp.7atigx17sv
Filesystem UUID: 8f2a74a4-809c-471e-b4ad-a91bfd51d7c3
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file dir_nlink extra_isize
Filesystem flags: unsigned_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 812800
Block count: 3244676
Reserved block count: 133252
Free blocks: 99790
Free inodes: 583647
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 420
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8128
Inode blocks per group: 508
Flex block group size: 16
Filesystem created: Thu Feb 13 17:30:14 2020
Last mount time: Fri Jul 3 14:38:44 2020
Last write time: Fri Jul 3 14:39:52 2020
Mount count: 0
Maximum mount count: -1
Last checked: Fri Jul 3 14:38:44 2020
Check interval: 0 (
Line 359 partnewsize: 13290004480 newpartend: 13290004480 parted: invalid token: primary Error: Expecting a file system type. pishrink.sh: ERROR occured in line 370: parted failed with rc 1 `
Can anybody help me, please? Greetz Conan
Remove quotes in this line around $parttype
No canches, same error
Hm ... add following line set -x
before the parted call and set +x
after the parted call to see the actual command executed.
The filesystem on /dev/loop3 is now 3240611 (4k) blocks long.
Line 359 partnewsize: 13273542656 newpartend: 13273542656
- parted -s /mnt/f/assas/pishrink.bin unit B mkpart primary 0 13273542656 parted: invalid token: primary Error: Expecting a file system type.
- set +x pishrink.sh: Shrinking image ... Line 386 endresult: 0 Line 423 aftersize: 0 pishrink.sh: Shrunk /mnt/f/assas/pishrink.bin from 60G to 0 ...
now, the file are empty...
man parted gives
mkpart part-type [fs-type] start end
Make a part-type partition for filesystem fs-type (if specified), beginning at start and ending at end (by
default in megabytes). part-type should be one of "primary", "logical", or "extended".
and the parted command shown complies to this syntax. You get various hits when you search for parted: invalid token: primary
. But I don't get an idea what's the root cause for your error message :disappointed:
I think, the probem is. My image are not the full card but only the 2nd partition from the SD card. The script assumes, however, that the image has two patition, the / boot and / formatted with ext4, where all the data is.
Correct, you do need a full image of the sd card not just a single partition. I'm going to leave this ticket open to try and detect this case and print a better error message
Hello. thanks for your great tool @Drewsif.
I'm facing the exact same problem. Any chance you would add this feature to shrink only a IMG of a partition ? thxs in advance.