LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   disappearing partition trick, formatting micro sd, and random space consumed (https://www.linuxquestions.org/questions/linux-general-1/disappearing-partition-trick-formatting-micro-sd-and-random-space-consumed-4175560810/)

cg132 12-06-2015 03:26 PM

disappearing partition trick, formatting micro sd, and random space consumed
 
First off I'd like to say sorry for starting a thread in General. I was thinking about starting it under hardware since its related to an SD card, then I was thinking I should put it under software since its related to mkfs. I was also thinking about going under the slackware area because I'm slacking. But hey....general seemed good.

Maybe someone can help me understand what I'm doing wrong, or at least sympathize and confirm the problem is real and not just in my head.

So I fdisk a new partition and it shows up. Then I mkfs.vfat mmcblk0p1 and it vanishes.
Code:

cg132@laptop:~$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0925948 s, 11.3 MB/s
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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

cg132@laptop:~$ sudo /sbin/fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.21.2).

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
Building a new DOS disklabel with disk identifier 0xd48f9117.

Command (m for help): n
Partition type:
  p  primary (0 primary, 0 extended, 4 free)
  e  extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-131071999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-131071999, default 131071999):
Using default value 131071999
Partition 1 of type Linux and of size 62.5 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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
Disk identifier: 0xd48f9117

        Device Boot      Start        End      Blocks  Id  System
/dev/mmcblk0p1            2048  131071999    65534976  83  Linux
cg132@laptop:~$ sudo /sbin/mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.22 (2013-07-19)
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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

cg132@laptop:~$ ?

What the heck? So I tried again with 10M block size

Code:

cg132@laptop:~$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=10M count=1
1+0 records in
1+0 records out
10485760 bytes (10 MB) copied, 2.53113 s, 4.1 MB/s
cg132@laptop:~$ sudo /sbin/fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.21.2).

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
Building a new DOS disklabel with disk identifier 0x48d894ce.

Command (m for help): n
Partition type:
  p  primary (0 primary, 0 extended, 4 free)
  e  extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-131071999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-131071999, default 131071999):
Using default value 131071999
Partition 1 of type Linux and of size 62.5 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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
Disk identifier: 0x48d894ce

        Device Boot      Start        End      Blocks  Id  System
/dev/mmcblk0p1            2048  131071999    65534976  83  Linux
cg132@laptop:~$ sudo /sbin/mkfs.vfat /dev/mmcblk0p1
mkfs.fat 3.0.22 (2013-07-19)
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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
Disk identifier: 0x48d894ce

        Device Boot      Start        End      Blocks  Id  System
/dev/mmcblk0p1            2048  131071999    65534976  83  Linux
cg132@laptop:~$ sudo mount /dev/mmcblk0p1 /mnt/floppy/
cg132@laptop:~$ df -h
Filesystem      Size  Used Avail Use Mounted on
/dev/sda3        22G  18G  2.9G  86% /
/dev/sda1      976M  17M  892M  2% /boot
tmpfs          3.8G    0  3.8G  0% /dev/shm
/dev/mmcblk0p1  63G  20G  44G  31% /mnt/floppy
cg132@laptop:~$ D-:

Wow! Now my partition is there after mkfs but 20gb has been eaten by gremlins. Now what? Should I skeet shoot this card and be done with it? I used it to store a video game install. The card was always readable and reinstalled the game without a problem so I don't think the card is bad.

How do I get my 20gb back? The card is blank as far as I can tell. Any suggestions?

Cheers
132

berndbausch 12-06-2015 05:14 PM

I don't see you doing anything wrong. Perhaps the card is broken: http://forums.anandtech.com/showthread.php?t=2335234 (and many more links when you google for "check sd card").

cg132 12-07-2015 03:32 AM

The card is not bad. I've been using it to store a very large video game install, about 30gb, and the data always came back clean. Just to be sure I formatted the card in windows without issue. Trying not to advocate windows here but it seems to handle the card just fine. I flip over to *nix and the card acts normal now that windows molested it. I use SD cards frequently, and I've thrown out quite a few over the years, but I've never seen this before. Well I've seen all kinds of hocus pocus including the disappearing partition table, file system corruption, and dead cards that take data and comes back with gibberish. However I've never seen 20gb of gremlins consuming the card without any files being present. Thought I'd bring it up here to see if there was a solution. Figured there must be a better way to do things. I must admit this is the only SDXC(64gb) card I have. I haven't seen this problem on any SDHC(32gb) cards. I was saying I should skeet shoot it just to prevent the gremlins from spreading across my network, the internet, and possibly take over the world! :-P

cg132 12-07-2015 03:47 AM

Found my problem. EXFat. You can slap me with a rotten fish now. Guess SDXC requires exfat. vfat, ext2, ext3, ext4, reiserfs, jfs....none of them work. But exfat does. <sigh>

syg00 12-07-2015 04:23 AM

Thanks for the postback. That is seriously twisted.

oldtechaa 12-07-2015 06:56 AM

Another thing I noticed is that in fdisk, you are not changing the partition type label to FAT. You're leaving it on "Linux". It really should be on one of the FAT options instead. That can be done with a "t" command in fdisk.

cg132 12-08-2015 11:39 AM

Checked....didn't help.
Code:

cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
252 heads, 59 sectors/track, 8815 cylinders, total 131072000 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
Disk identifier: 0x00000000

        Device Boot      Start        End      Blocks  Id  System
/dev/mmcblk0p1            2048  131071999    65534976    b  W95 FAT32
cg132@laptop:~$ sudo /sbin/mount /dev/mmcblk0p1 /mnt/floppy/
cg132@laptop:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        22G  19G  2.4G  89% /
/dev/sda1      976M  17M  892M  2% /boot
tmpfs          3.8G    0  3.8G  0% /dev/shm
/dev/sda2      137G  125G  12G  92% /windows
/dev/mmcblk0p1  63G  20G  44G  31% /mnt/floppy


cg132 12-08-2015 12:06 PM

Just to be extra sure. I created a linux type partition table and formatted it with exfat. Looks better than the mess windows made of the partition table.
Code:

cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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

cg132@laptop:~$ sudo /sbin/fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.21.2).

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
Building a new DOS disklabel with disk identifier 0xf6d89914.

Command (m for help): p

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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
Disk identifier: 0xf6d89914

        Device Boot      Start        End      Blocks  Id  System

Command (m for help): n
Partition type:
  p  primary (0 primary, 0 extended, 4 free)
  e  extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-131071999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-131071999, default 131071999):
Using default value 131071999
Partition 1 of type Linux and of size 62.5 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
cg132@laptop:~$ sudo /usr/sbin/mkfs.exfat /dev/mmcblk0p1
mkexfatfs 1.2.1
Creating... done.
Flushing... done.
File system created successfully.
cg132@laptop:~$ sudo /sbin/fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 67.1 GB, 67108864000 bytes
4 heads, 16 sectors/track, 2048000 cylinders, total 131072000 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
Disk identifier: 0xf6d89914

        Device Boot      Start        End      Blocks  Id  System
/dev/mmcblk0p1            2048  131071999    65534976  83  Linux
cg132@laptop:~$ sudo mount /dev/mmcblk0p1 /mnt/floppy/
FUSE exfat 1.2.1
cg132@laptop:~$ df -h     
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        22G  19G  2.4G  89% /
/dev/sda1      976M  17M  892M  2% /boot
tmpfs          3.8G    0  3.8G  0% /dev/shm
/dev/sda2      137G  125G  12G  92% /windows
/dev/mmcblk0p1  63G  2.8M  63G  1% /mnt/floppy
cg132@laptop:~$



All times are GMT -5. The time now is 07:02 AM.