Re-partition USB key

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Sep 10 21:57:01 UTC 2009


On Wed, Sep 09, 2009 at 10:24:19PM +0000, Antonio T. Sun wrote:
> I re-partitioned my USB key using gparted, but I'm having a hard
> time trying to make my mount know the changes.
> 
> This is what it was before:
> 
>   $ sfdisk -l -uM
> 
>   Disk /dev/sdb: 499 cylinders, 255 heads, 63 sectors/track
>   Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 
> 0
> 
>      Device Boot Start   End    MiB    #blocks   Id  System
>   /dev/sdb1         0+   807-   808-    827316    6  FAT16
>   /dev/sdb2   *   807+  1796-   989-   1012095   83  Linux
>   /dev/sdb3      1796+  2784-   989-   1012095   83  Linux
>   /dev/sdb4      2784+  3914-  1130-   1156680   83  Linux
> 
> This is what it is now:
> 
>   $ sfdisk -l -uM /dev/sdb
> 
>   Disk /dev/sdb: 499 cylinders, 255 heads, 63 sectors/track
>   Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 
> 0
> 
>      Device Boot Start   End    MiB    #blocks   Id  System
>   /dev/sdb1         0+   807-   808-    827316    6  FAT16
>   /dev/sdb2   *   807+  3208-  2401-   2457945   83  Linux
>   /dev/sdb3      3208+  3914-   706-    722925   83  Linux
>   /dev/sdb4         0      -      0          0    0  Empty
> 
> Now watch:
> 
>   % mount /dev/sdb2 /mnt/tmp2/
> 
>   $ df | grep sdb
>   /dev/sdb2               996148      1464    944080   1% /mnt/tmp2
> 
>   % umount /dev/sdb2
> 
>   $ sfdisk -V /dev/sdb 
>   /dev/sdb: OK
> 
> I.e., when I mount the newly-changed 2G sdb2, 'mount' still gives me
> a 989M disk. I've unplugged and replugged the USB key several times,
> and even replugged to different USB port, but still NOK. Why?

What does /proc/partitions show the size to be?  df shows the size of
the filesystem, not the partition.

> How can I fix it? 

Did you do a new mkfs on the partionions after you changed them?
After all the partition doesn't control the size of the filesystem.

parted can resize the filesystem at the same time if you ask it too,
but make sure you unmounted all partitions before you used parted.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list