0

I am using parted to resize a memory block.

Please find the set of comments I used below.

# ./parted /dev/mmcblk0p1
GNU Parted 1.8.8.1.179-aef3
Using /dev/mmcblk0p1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
print
Model: Unknown (unknown)
Disk /dev/mmcblk0p1: 2976MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      8192B  2976MB  2976MB  primary  fat32        lba


(parted) check 1                                                          
check 1

(parted) resize 1                                                         
resize 1
Start?  [8192B]? 8192B                                                    
8192B
End?  [2976MB]? 2900MB                                                    
2900MB

# ./parted /dev/mmcblk0p1
GNU Parted 1.8.8.1.179-aef3
Using /dev/mmcblk0p1
Welcome to GNU Parted! Type 'help' to view a list of commands.


(parted) print                                                            
print
Model: Unknown (unknown)
Disk /dev/mmcblk0p1: 2976MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      8192B  2900MB  2900MB  primary  fat32        lba

(parted) check 1                                                          
check 1
Fatal: Bad FAT: unterminated chain for \SYSTEM\TEST_C~1.CON.  You should run
dosfsck or scandisk.
(parted) quit  

Is this an issue because of file defragmentation?

1 Answer 1

0

The normal steps to shrink a filesystem (from the end), are defrag it, shrink the filesystem itself, then shrink the partition. Some partition editors (gparted) will do the "shrink the filesystem" for you if the fs is the right type (ext?) and the resize2fs program is present (it is by default)). In your case, you probably have to run fatresize yourself, but first you will have to install it.

sudo apt-get update
sudo apt-get install fatresize

Then check the newly resized filesystem, then shrink the partition.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .