[SOLVED] disappearing partition trick, formatting micro sd, and random space consumed
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Last edited by cg132; 12-06-2015 at 04:00 PM.
Reason: spelling error
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
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>
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.
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:~$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.