12

I've seem some posts about similar issues, but couldn't find one with a solution to my problem. I'm running Ubuntu 14.04 on my PC and I wish to resize and add a partition on a USB stick which holds a live version of ubuntu 14.04.

I've loaded Gparted using a live gparted CD. I've then resized the only partition on it to hold the data and left some free space In the new unallocated partition I've created a partition with ex4 file system. when applying changes I've encountered an error shrinking the first partition.

Does anyone have any idea how to solve this issue ?

Here's the output of the error:

GParted 0.18.0 --enable-libparted-dmraid --enable-online-resize

Libparted 2.3
Shrink /dev/sdb1 from 7.47 GiB to 2.59 GiB  00:00:05    ( ERROR )

calibrate /dev/sdb1  00:00:00    ( SUCCESS )

path: /dev/sdb1
start: 2048
end: 15667199
size: 15665152 (7.47 GiB)
check file system on /dev/sdb1 for errors and (if possible) fix them  00:00:03    ( SUCCESS )

fsck.fat -a -w -v /dev/sdb1

fsck.fat 3.0.26 (2014-03-07)
fsck.fat 3.0.26 (2014-03-07)
Checking we can access the last sector of the filesystem
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
1:58/5a, 3:53/4d, 4:59/53, 5:53/57, 6:4c/49, 7:49/4e, 8:4e/34, 9:55/2e
, 10:58/31, 90:fa/00, 91:fc/00, 92:31/00, 93:c9/00, 94:8e/00, 95:d1/00
, 96:bc/00, 97:76/00, 98:7b/00, 99:52/00, 100:06/00, 101:57/00, 102:1e/00
, 103:56/00, 104:8e/00, 105:c1/00, 106:b1/00, 107:26/00, 108:bf/00
, 109:78/00, 110:7b/00, 111:f3/00, 112:a5/00, 113:8e/00, 114:d9/00
, 115:bb/00, 116:78/00, 118:0f/00, 119:b4/00, 120:37/00, 121:0f/00
, 122:a0/00, 123:56/00, 124:20/00, 125:d2/00, 126:78/00, 127:1b/00
, 128:31/00, 129:c0/00, 130:b1/00, 131:06/00, 132:89/00, 133:3f/00
, 134:89/00, 135:47/00, 136:02/00, 137:f3/00, 138:64/00, 139:a5/00
, 140:8a/00, 141:0e/00, 142:18/00, 143:7c/00, 144:88/00, 145:4d/00
, 146:f8/00, 147:50/00, 148:50/00, 149:50/00, 150:50/00, 151:cd/00
, 152:13/00, 153:eb/00, 154:62/00, 155:8b/00, 156:55/00, 157:aa/00
, 158:8b/00, 159:75/00, 160:a8/00, 161:c1/00, 162:ee/00, 163:04/00
, 164:01/00, 165:f2/00, 166:83/00, 167:fa/00, 168:4f/00, 169:76/00
, 170:31/00, 171:81/00, 172:fa/00, 173:b2/00, 174:07/00, 175:73/00
, 176:2b/00, 177:f6/00, 178:45/00, 179:b4/00, 180:7f/00, 181:75/00
, 182:25/00, 183:38/00, 184:4d/00, 185:b8/00, 186:74/00, 187:20/00
, 188:66/00, 189:3d/00, 190:21/00, 191:47/00, 192:50/00, 193:54/00
, 194:75/00, 195:10/00, 196:80/00, 197:7d/00, 198:b8/00, 199:ed/00
, 200:75/00, 201:0a/00, 202:66/00, 203:ff/00, 204:75/00, 205:ec/00
, 206:66/00, 207:ff/00, 208:75/00, 209:e8/00, 210:eb/00, 211:0f/00
, 212:51/00, 213:51/00, 214:66/00, 215:ff/00, 216:75/00, 217:bc/00
, 218:eb/00, 219:07/00, 220:51/00, 221:51/00, 222:66/00, 223:ff/00
, 224:36/00, 225:1c/00, 226:7c/00, 227:b4/00, 228:08/00, 229:e8/00
, 230:e9/00, 232:72/00, 233:13/00, 234:20/00, 235:e4/00, 236:75/00
, 237:0f/00, 238:c1/00, 239:ea/00, 240:08/00, 241:42/00, 242:89/00
, 243:16/00, 244:1a/00, 245:7c/00, 246:83/00, 247:e1/00, 248:3f/00
, 249:89/00, 250:0e/00, 251:18/00, 252:7c/00, 253:fb/00, 254:bb/00
, 255:aa/00, 256:55/00, 257:b4/00, 258:41/00, 259:e8/00, 260:cb/00
, 262:72/00, 263:10/00, 264:81/00, 265:fb/00, 266:55/00, 267:aa/00
, 268:75/00, 269:0a/00, 270:f6/00, 271:c1/00, 272:01/00, 273:74/00
, 274:05/00, 275:c6/00, 276:06/00, 277:46/00, 278:7d/00, 280:66/00
, 281:b8/00, 282:46/00, 283:ee/00, 286:66/00, 287:ba/00, 292:bb/00
, 294:80/00, 295:e8/00, 296:0e/00, 298:66/00, 299:81/00, 300:3e/00
, 301:1c/00, 302:80/00, 303:a1/00, 304:f3/00, 305:42/00, 306:6f/00
, 307:75/00, 308:74/00, 309:e9/00, 310:f8/00, 311:02/00, 312:66/00
, 313:03/00, 314:06/00, 315:60/00, 316:7b/00, 317:66/00, 318:13/00
, 319:16/00, 320:64/00, 321:7b/00, 322:b9/00, 323:10/00, 325:eb/00
, 326:2b/00, 327:66/00, 328:52/00, 329:66/00, 330:50/00, 331:06/00
, 332:53/00, 333:6a/00, 334:01/00, 335:6a/00, 336:10/00, 337:89/00
, 338:e6/00, 339:66/00, 340:60/00, 341:b4/00, 342:42/00, 343:e8/00
, 344:77/00, 346:66/00, 347:61/00, 348:8d/00, 349:64/00, 350:10/00
, 351:72/00, 352:01/00, 353:c3/00, 354:66/00, 355:60/00, 356:31/00
, 357:c0/00, 358:e8/00, 359:68/00, 361:66/00, 362:61/00, 363:e2/00
, 364:da/00, 365:c6/00, 366:06/00, 367:46/00, 368:7d/00, 369:2b/00
, 370:66/00, 371:60/00, 372:66/00, 373:0f/00, 374:b7/00, 375:36/00
, 376:18/00, 377:7c/00, 378:66/00, 379:0f/00, 380:b7/00, 381:3e/00
, 382:1a/00, 383:7c/00, 384:66/00, 385:f7/00, 386:f6/00, 387:31/00
, 388:c9/00, 389:87/00, 390:ca/00, 391:66/00, 392:f7/00, 393:f7/00
, 394:66/00, 395:3d/00, 396:ff/00, 397:03/00, 400:77/00, 401:17/00
, 402:c0/00, 403:e4/00, 404:06/00, 405:41/00, 406:08/00, 407:e1/00
, 408:88/00, 409:c5/00, 410:88/00, 411:d6/00, 412:b8/00, 413:01/00
, 414:02/00, 415:e8/00, 416:2f/00, 418:66/00, 419:61/00, 420:72/00
, 421:01/00, 422:c3/00, 423:e2/00, 424:c9/00, 425:31/00, 426:f6/00
, 427:8e/00, 428:d6/00, 429:bc/00, 430:68/00, 431:7b/00, 432:8e/00
, 433:de/00, 434:66/00, 435:8f/00, 436:06/00, 437:78/00, 439:be/00
, 440:da/00, 441:7d/00, 442:ac/00, 443:20/00, 444:c0/00, 445:74/00
, 446:09/00, 447:b4/00, 448:0e/00, 449:bb/00, 450:07/00, 452:cd/00
, 453:10/00, 454:eb/00, 455:f2/00, 456:31/00, 457:c0/00, 458:cd/00
, 459:16/00, 460:cd/00, 461:19/00, 462:f4/00, 463:eb/00, 464:fd/00
, 465:8a/00, 466:16/00, 467:74/00, 468:7b/00, 469:06/00, 470:cd/00
, 471:13/00, 472:07/00, 473:c3/00, 474:42/00, 475:6f/00, 476:6f/00
, 477:74/00, 478:20/00, 479:65/00, 480:72/00, 481:72/00, 482:6f/00
, 483:72/00, 484:0d/00, 485:0a/00, 504:fe/00, 505:02/00, 506:b2/00
, 507:3e/00, 508:18/00, 509:37/00
Not automatically fixing this.
Boot sector contents:
System ID "SYSLINUX"
Media byte 0xf8 (hard disk)
512 bytes per logical sector
2048 bytes per cluster
32 reserved sectors
First FAT starts at byte 16384 (sector 32)
2 FATs, 32 bit entries
15604224 bytes per FAT (= 30477 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 31224832 (sector 60986)
3901041 data clusters (7989331968 bytes)
63 sectors/track, 255 heads
2048 hidden sectors
15665152 sectors total
Reclaiming unconnected clusters.
Checking free cluster summary.
/dev/sdb1: 248 files, 504715/3901041 clusters
shrink file system  00:00:02    ( ERROR )

using libparted
libparted messages    ( INFO )

GNU Parted cannot resize this partition to this size. We're working on it!

========================================
Create Primary Partition #1 (ext4, 4.88 GiB) on /dev/sdb

========================================
  • If Windows is available, run chkdsk /f /r on the drive letter. If you have GNU/Linux only, you might try sudo dosfsck -v -V -r /dev/sdb1 to fix the problem. If these fix the issue, then use the latest version of GParted (currently 0.20.0). The latest version is available on GParted Live. – Curtis Gedak Dec 12 '14 at 22:27
2

Linux's fschk doesn't reliably fix all FAT errors. If you can lay your hands on a Windows machine, do a chkdsk /f x: where x is the drive letter of the USB on that machine and then resize again.

If you do not have access to a Windows machine, download FreeDOS.

  • Just a comment to the puritans who're going to flag this problem as "not about Ubuntu": the error is in Ubuntu, the solution (currently) is not and the user has been helped... – Fabby Dec 8 '14 at 19:45
  • 1
    Thanks! I'll try that. In the meanwhile I tried some other solutions which failed to work: I've used gparted live cd. This time it didn't crash but it couldn't change the size of the partition... don't know why. I suspect it either has something to do the the pendrive I've been using or the 32bit version of ubuntu which I installed on it (I had no choice but to use a 32bit version... trust me, I wish I could use the 64bit). Anyway, I still havn't solved this but I will definitely try the chkdsk /f option. – Adi Lavy Dec 9 '14 at 20:27
  • If it works, please accept the answer and when you've earned enough reputation on this site, don't forget to come back and vote it up! ;-) – Fabby Dec 9 '14 at 20:50
6

Thanks everyone! I did use Fabby's suggestion and ran chkdsk and there were errors that windows corrected, but it did not solve the issue I had.

I've decided that it could be that the pen drive itself is the source of the problem so I replaced it with another pen drive and repeated the steps (formatting to FAT32, installing a bootable live Ubuntu with persistent, deleting casper-rw file, re-sizing using GParted live CD and creating a new directory names casper-rw).

This time it worked!

4

This seems to be a bug with the particular version of gparted in Ubuntu 14.04. Repeated failures with resizing fat32 partitions using Ubuntu 14.04 is also reported in this Askubuntu question.

The solution (for me) is quite simple. Use Ubuntu 12.04 or earlier versions either on another machine or from a liveusb. I was able to shrink fat32 partitions on thumb-drives without a problem.

  • 2
    wow talk about a complete failure on a distro. This bug is probably the worst thing that could happen. – Kalamalka Kid Jan 15 '16 at 8:06
1

If the goal is to have a live ubuntu on flash drive with persistent partition, you do not even need a Gparted Live CD. You can set up partitions first and then install live ubuntu later with usb-creator-gtk.

Just boot from ubuntu cd or even use virtualbox to run ubuntu and all can be done in one session. The version of Gparted available for Ubuntu can create and remove partitions with no problem but always(?) fails in resizing partition.

1

I just built libparted/Gparted from git source on Ubuntu 14.04, seems that FAT32 resize works with that; YMMV. Here are my notes (as example, I work in /tmp here, and I do not do an install; also sorry for the mess):

cd /tmp
## https://git.gnome.org/browse/gparted/tree/README
## c. Building using a Specific (lib)parted Version
git clone git://git.debian.org/git/parted/parted.git parted_git
cd parted_git/
# WARNING: USING PARTED TO PERFORM FILE SYSTEM OPERATIONS IS NO LONGER SUPPORTED
#./bootstrap
#./bootstrap: Error: 'gperf' not found
#./bootstrap: Error: 'makeinfo' not found
# ./bootstrap: Please install the prerequisite programs
sudo apt-get install gperf
sudo apt-get install texinfo # makeinfo; WARNING: The following packages cannot be authenticated: libxml-libxml-perl
./bootstrap
#./configure
# configure: error: libdevmapper could not be found,
# sudo apt-get install libdevmapper1.02.1 - already the newest version.
sudo apt-get install libdevmapper-dev # WARNING: The following packages cannot be authenticated! - libsepol1-dev libselinux1-dev
# configure: error: termcap could not be found
sudo apt-get install libncurses5-dev
# sudo apt-get install libreadline6 - already newest
sudo apt-get install libreadline6-dev
./configure
#make
# ui.c:1477:41: error: 'CPPFunction' undeclared (first use in this function)
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741767
sed -i 's/CPPFunction/rl_completion_func_t/' ./parted/ui.c
make
# built now... ./libparted/.libs/libparted.so; ./libparted/fs/.libs/libparted-fs-resize.so; ./parted/parted
# $ ./parted/parted --version # parted (GNU parted) 3.1.52-1c659-dirty; bash shell script

cd ..
git clone git://git.gnome.org/gparted gparted_git
cd gparted_git
#./autogen.sh
# You need to install gnome-common
sudo apt-get install gnome-common
# Cannot find file: gnome-doc-utils.make
# You need to install gnome-doc-utils
sudo apt-get install gnome-doc-utils
# configure: error: *** libuuid not found.
# sudo apt-get install libuuid1 - installed
# sudo apt-get install libuuidm-ocaml-dev - no dice; removed
sudo apt-get install uuid-dev # WARNING: The following packages cannot be authenticated?
# configure: error: *** libparted not found. --- build parted; use env vars CPPFLAGS etc...
# **Warning**: I am going to run `configure' with no arguments.
# If you wish to pass any to it, please specify them on the
# `./autogen.sh' command line.
# checking for libparted >= 1.7.1 (querying pkg-config)... 3.1.52-1c659-dirty #(otherwise trusty 2.3-19ubuntu1.14.04.1)
# No package 'gtkmm-2.4' found
# sudo apt-get install libgtkmm-2.4-1c2a - is already the newest version.
sudo apt-get install libgtkmm-2.4-dev
# https://mail.gnome.org/archives/commits-list/2012-March/msg01187.html
# The parted-3.1 release brings back FAT16/FAT32 and HFS/HFS+ file
#    system resize capabilities in a new libparted fs resize library.
CPPFLAGS=-I/tmp/parted_git/include \
LDFLAGS="-L/tmp/parted_git/libparted/.libs -L/tmp/parted_git/libparted/fs/.libs" \
LD_RUN_PATH=/tmp/parted_git/libparted/.libs:/tmp/parted_git/libparted/fs/.libs \
PKG_CONFIG_PATH=/tmp/parted_git \
./autogen.sh --enable-online-resize

#       --- Features Based On Libparted Version ---
#       Need delete old partitions before
#              creating a loop table workaround?  :  no
#       Need partition table re-read workaround?  :  no
#     Supports large sector sizes (> 512 bytes)?  :  yes
#   Have old libparted file system resizing API?  :  no
#   Have new libparted file system resizing LIB?  :  yes
#                  Enable online resize support?  :  yes
#

make #-j 2

# file gparted: POSIX shell script, ASCII text executable; /usr/local/sbin/gpartedbin: not found
# file ./src/gpartedbin:  Bourne-Again shell script, ASCII text executable, with very long lines
# file ./src/.libs/gpartedbin: ELF 32-bit LSB  executable, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs),...
# version is GParted 0.26.0-git
gksu ./src/gpartedbin
#======================
#libparted : 3.1.52-1c659-dirty
#======================

# clean up:
sudo apt-get remove --purge gperf texinfo libdevmapper-dev libncurses5-dev libreadline6-dev && sudo apt-get autoremove --purge
sudo apt-get remove --purge gnome-common gnome-doc-utils uuid-dev libgtkmm-2.4-dev && sudo apt-get autoremove --purge
# gksu ./src/gpartedbin still works...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.