Public bug reported:

For some reason Linux (dd/mkfs.vfat/mkfs.ext4) treats the first
partition of my sdcard as 16GB regardless of what fdisk says it should
be. dd sees the other partitions as the correct size.

Also if I run mkfs.vfat on the first partition it is treated as a fuse
filesystem when mounted, it seems very strange. The whole card has been
zeroed out so it shouldn't be an issue of some other weird data on the
card. Pulling and reinserting the card after partitioning makes no
difference. I have also included the fdisk bootsector dump at the end of
this message.

Running linux 4.4.0-38.57 amd64

---

ii  linux-headers-4.4.0-38                       4.4.0-38.57                    
            all          Header files related to Linux kernel version 4.4.0
ii  linux-headers-4.4.0-38-generic               4.4.0-38.57                    
            amd64        Linux kernel headers for version 4.4.0 on 64 bit x86 
SMP
ii  linux-image-4.4.0-38-generic                 4.4.0-38.57                    
            amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-38-generic           4.4.0-38.57                    
            amd64        Linux kernel extra modules for version 4.4.0 on 64 bit 
x86 SMP
ii  linux-signed-image-4.4.0-38-generic          4.4.0-38.57                    
            amd64        Signed kernel image generic
ii  linux-tools-4.4.0-38                         4.4.0-38.57                    
            amd64        Linux kernel version specific tools for version 
4.4.0-38
ii  linux-tools-4.4.0-38-generic                 4.4.0-38.57                    
            amd64        Linux kernel version specific tools for version 
4.4.0-38

---

# fdisk -l /dev/sdd
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

# fdisk /dev/sdd

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x57ca34c2.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62521343, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-62521343, default 62521343): 
+512MiB

Created a new partition 1 of type 'Linux' and of size 512 MiB.

Command (m for help): p
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot Start     End Sectors  Size Id Type
/dev/sdd1        2048 1050623 1048576  512M 83 Linux

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (1050624-62521343, default 1050624):
Last sector, +sectors or +size{K,M,G,T,P} (1050624-62521343, default 62521343): 
+512MiB

Created a new partition 2 of type 'Linux' and of size 512 MiB.

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3):
First sector (2099200-62521343, default 2099200):
Last sector, +sectors or +size{K,M,G,T,P} (2099200-62521343, default 62521343): 
+1024MiB

Created a new partition 3 of type 'Linux' and of size 1 GiB.

Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): p

Selected partition 4
First sector (4196352-62521343, default 4196352):
Last sector, +sectors or +size{K,M,G,T,P} (4196352-62521343, default 62521343):

Created a new partition 4 of type 'Linux' and of size 27.8 GiB.

Command (m for help): print
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdd1          2048  1050623  1048576  512M 83 Linux
/dev/sdd2       1050624  2099199  1048576  512M 83 Linux
/dev/sdd3       2099200  4196351  2097152    1G 83 Linux
/dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux

Command (m for help): t
Partition number (1-4, default 4): 1
Partition type (type L to list all types): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): print
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
/dev/sdd2       1050624  2099199  1048576  512M 83 Linux
/dev/sdd3       2099200  4196351  2097152    1G 83 Linux
/dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

# blockdev --rereadpt /dev/sdd

# fdisk -l /dev/sdd
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
/dev/sdd2       1050624  2099199  1048576  512M 83 Linux
/dev/sdd3       2099200  4196351  2097152    1G 83 Linux
/dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux

# dd if=/dev/zero of=/dev/sdd1 bs=8M
dd: error writing '/dev/sdd1': No space left on device
2002+0 records in
2001+0 records out
16786972672 bytes (17 GB, 16 GiB) copied, 7.27734 s, 2.3 GB/s

# dd if=/dev/zero of=/dev/sdd2 bs=8M
dd: error writing '/dev/sdd2': No space left on device
65+0 records in
64+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 6.76225 s, 79.4 MB/s

# dd if=/dev/zero of=/dev/sdd3 bs=8M
dd: error writing '/dev/sdd3': No space left on device
129+0 records in
128+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 13.7579 s, 78.0 MB/s

# dd if=/dev/zero of=/dev/sdd4 bs=8M
dd: error writing '/dev/sdd4': No space left on device
3560+0 records in
3559+0 records out
29862395904 bytes (30 GB, 28 GiB) copied, 370.45 s, 80.6 MB/s

# fdisk -l /dev/sdd
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
/dev/sdd2       1050624  2099199  1048576  512M 83 Linux
/dev/sdd3       2099200  4196351  2097152    1G 83 Linux
/dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux

---

Expert command (m for help): p
Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x57ca34c2

Device     Boot   Start      End  Sectors Id Type            Start-C/H/S 
End-C/H/S Attrs
/dev/sdd1          2048  1050623  1048576  c W95 FAT32 (LBA)       1/1/0 
512/32/63
/dev/sdd2       1050624  2099199  1048576 83 Linux               513/1/0   
0/32/63
/dev/sdd3       2099200  4196351  2097152 83 Linux                 1/1/0   
0/32/63
/dev/sdd4       4196352 62521343 58324992 83 Linux                 1/1/0 
831/32/63

---

Expert command (m for help): d

First sector: offset = 0, size = 512 bytes.
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
*
000001b0  00 00 00 00 00 00 00 00  c2 34 ca 57 00 00 00 00
000001c0  01 01 0c 3f a0 00 00 08  00 00 00 00 10 00 00 00
000001d0  81 01 83 3f 20 00 00 08  10 00 00 00 10 00 00 00
000001e0  01 01 83 3f 20 00 00 08  20 00 00 00 20 00 00 00
000001f0  01 01 83 3f e0 3f 00 08  40 00 00 f8 79 03 55 aa

---

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

- For some reason Linux treats the first partition of my sdcard as 16GB
- regardless of what fdisk says it should be. dd sees the other partitions
- as the correct size.
+ For some reason Linux (dd/mkfs.vfat/mkfs.ext4) treats the first
+ partition of my sdcard as 16GB regardless of what fdisk says it should
+ be. dd sees the other partitions as the correct size.
  
  Also if I run mkfs.vfat on the first partition it is treated as a fuse
  filesystem when mounted, it seems very strange. The whole card has been
  zeroed out so it shouldn't be an issue of some other weird data on the
  card. Pulling and reinserting the card after partitioning makes no
  difference. I have also included the fdisk bootsector dump at the end of
  this message.
  
  Running linux 4.4.0-38.57 amd64
  
  ---
  
  ii  linux-headers-4.4.0-38                       4.4.0-38.57                  
              all          Header files related to Linux kernel version 4.4.0
  ii  linux-headers-4.4.0-38-generic               4.4.0-38.57                  
              amd64        Linux kernel headers for version 4.4.0 on 64 bit x86 
SMP
  ii  linux-image-4.4.0-38-generic                 4.4.0-38.57                  
              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 
SMP
  ii  linux-image-extra-4.4.0-38-generic           4.4.0-38.57                  
              amd64        Linux kernel extra modules for version 4.4.0 on 64 
bit x86 SMP
  ii  linux-signed-image-4.4.0-38-generic          4.4.0-38.57                  
              amd64        Signed kernel image generic
  ii  linux-tools-4.4.0-38                         4.4.0-38.57                  
              amd64        Linux kernel version specific tools for version 
4.4.0-38
  ii  linux-tools-4.4.0-38-generic                 4.4.0-38.57                  
              amd64        Linux kernel version specific tools for version 
4.4.0-38
  
  ---
  
  # fdisk -l /dev/sdd
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  
  # fdisk /dev/sdd
  
  Welcome to fdisk (util-linux 2.27.1).
  Changes will remain in memory only, until you decide to write them.
  Be careful before using the write command.
  
  Device does not contain a recognized partition table.
  Created a new DOS disklabel with disk identifier 0x57ca34c2.
  
  Command (m for help): n
  Partition type
-    p   primary (0 primary, 0 extended, 4 free)
-    e   extended (container for logical partitions)
+    p   primary (0 primary, 0 extended, 4 free)
+    e   extended (container for logical partitions)
  Select (default p): p
  Partition number (1-4, default 1): 1
- First sector (2048-62521343, default 2048): 
+ First sector (2048-62521343, default 2048):
  Last sector, +sectors or +size{K,M,G,T,P} (2048-62521343, default 62521343): 
+512MiB
  
  Created a new partition 1 of type 'Linux' and of size 512 MiB.
  
  Command (m for help): p
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot Start     End Sectors  Size Id Type
  /dev/sdd1        2048 1050623 1048576  512M 83 Linux
  
  Command (m for help): n
  Partition type
-    p   primary (1 primary, 0 extended, 3 free)
-    e   extended (container for logical partitions)
+    p   primary (1 primary, 0 extended, 3 free)
+    e   extended (container for logical partitions)
  Select (default p): p
- Partition number (2-4, default 2): 
- First sector (1050624-62521343, default 1050624): 
+ Partition number (2-4, default 2):
+ First sector (1050624-62521343, default 1050624):
  Last sector, +sectors or +size{K,M,G,T,P} (1050624-62521343, default 
62521343): +512MiB
  
  Created a new partition 2 of type 'Linux' and of size 512 MiB.
  
  Command (m for help): n
  Partition type
-    p   primary (2 primary, 0 extended, 2 free)
-    e   extended (container for logical partitions)
+    p   primary (2 primary, 0 extended, 2 free)
+    e   extended (container for logical partitions)
  Select (default p): p
- Partition number (3,4, default 3): 
- First sector (2099200-62521343, default 2099200): 
+ Partition number (3,4, default 3):
+ First sector (2099200-62521343, default 2099200):
  Last sector, +sectors or +size{K,M,G,T,P} (2099200-62521343, default 
62521343): +1024MiB
  
  Created a new partition 3 of type 'Linux' and of size 1 GiB.
  
  Command (m for help): n
  Partition type
-    p   primary (3 primary, 0 extended, 1 free)
-    e   extended (container for logical partitions)
+    p   primary (3 primary, 0 extended, 1 free)
+    e   extended (container for logical partitions)
  Select (default e): p
  
  Selected partition 4
- First sector (4196352-62521343, default 4196352): 
- Last sector, +sectors or +size{K,M,G,T,P} (4196352-62521343, default 
62521343): 
+ First sector (4196352-62521343, default 4196352):
+ Last sector, +sectors or +size{K,M,G,T,P} (4196352-62521343, default 
62521343):
  
  Created a new partition 4 of type 'Linux' and of size 27.8 GiB.
  
  Command (m for help): print
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot   Start      End  Sectors  Size Id Type
  /dev/sdd1          2048  1050623  1048576  512M 83 Linux
  /dev/sdd2       1050624  2099199  1048576  512M 83 Linux
  /dev/sdd3       2099200  4196351  2097152    1G 83 Linux
  /dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux
  
  Command (m for help): t
  Partition number (1-4, default 4): 1
  Partition type (type L to list all types): c
  
  Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
  
  Command (m for help): print
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot   Start      End  Sectors  Size Id Type
  /dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
  /dev/sdd2       1050624  2099199  1048576  512M 83 Linux
  /dev/sdd3       2099200  4196351  2097152    1G 83 Linux
  /dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux
  
  Command (m for help): w
  
  The partition table has been altered.
  Calling ioctl() to re-read partition table.
  Syncing disks.
  
  # blockdev --rereadpt /dev/sdd
  
  # fdisk -l /dev/sdd
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot   Start      End  Sectors  Size Id Type
  /dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
  /dev/sdd2       1050624  2099199  1048576  512M 83 Linux
  /dev/sdd3       2099200  4196351  2097152    1G 83 Linux
  /dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux
  
  # dd if=/dev/zero of=/dev/sdd1 bs=8M
  dd: error writing '/dev/sdd1': No space left on device
  2002+0 records in
  2001+0 records out
  16786972672 bytes (17 GB, 16 GiB) copied, 7.27734 s, 2.3 GB/s
  
  # dd if=/dev/zero of=/dev/sdd2 bs=8M
  dd: error writing '/dev/sdd2': No space left on device
  65+0 records in
  64+0 records out
  536870912 bytes (537 MB, 512 MiB) copied, 6.76225 s, 79.4 MB/s
  
  # dd if=/dev/zero of=/dev/sdd3 bs=8M
  dd: error writing '/dev/sdd3': No space left on device
  129+0 records in
  128+0 records out
  1073741824 bytes (1.1 GB, 1.0 GiB) copied, 13.7579 s, 78.0 MB/s
  
  # dd if=/dev/zero of=/dev/sdd4 bs=8M
  dd: error writing '/dev/sdd4': No space left on device
  3560+0 records in
  3559+0 records out
  29862395904 bytes (30 GB, 28 GiB) copied, 370.45 s, 80.6 MB/s
  
  # fdisk -l /dev/sdd
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot   Start      End  Sectors  Size Id Type
  /dev/sdd1          2048  1050623  1048576  512M  c W95 FAT32 (LBA)
  /dev/sdd2       1050624  2099199  1048576  512M 83 Linux
  /dev/sdd3       2099200  4196351  2097152    1G 83 Linux
  /dev/sdd4       4196352 62521343 58324992 27.8G 83 Linux
  
  ---
  
  Expert command (m for help): p
  Disk /dev/sdd: 29.8 GiB, 32010928128 bytes, 62521344 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0x57ca34c2
  
  Device     Boot   Start      End  Sectors Id Type            Start-C/H/S 
End-C/H/S Attrs
- /dev/sdd1          2048  1050623  1048576  c W95 FAT32 (LBA)       1/1/0 
512/32/63      
- /dev/sdd2       1050624  2099199  1048576 83 Linux               513/1/0   
0/32/63      
- /dev/sdd3       2099200  4196351  2097152 83 Linux                 1/1/0   
0/32/63      
- /dev/sdd4       4196352 62521343 58324992 83 Linux                 1/1/0 
831/32/63      
+ /dev/sdd1          2048  1050623  1048576  c W95 FAT32 (LBA)       1/1/0 
512/32/63
+ /dev/sdd2       1050624  2099199  1048576 83 Linux               513/1/0   
0/32/63
+ /dev/sdd3       2099200  4196351  2097152 83 Linux                 1/1/0   
0/32/63
+ /dev/sdd4       4196352 62521343 58324992 83 Linux                 1/1/0 
831/32/63
  
  ---
  
  Expert command (m for help): d
  
  First sector: offset = 0, size = 512 bytes.
  00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
  *
  000001b0  00 00 00 00 00 00 00 00  c2 34 ca 57 00 00 00 00
  000001c0  01 01 0c 3f a0 00 00 08  00 00 00 00 10 00 00 00
  000001d0  81 01 83 3f 20 00 00 08  10 00 00 00 10 00 00 00
  000001e0  01 01 83 3f 20 00 00 08  20 00 00 00 20 00 00 00
  000001f0  01 01 83 3f e0 3f 00 08  40 00 00 f8 79 03 55 aa
  
  ---

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1634005

Title:
  linux treats first partition on sdcard as much bigger than it really
  is?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1634005/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to