LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   USB-stick empty but 200 MB used? Parameters for fdisk? (https://www.linuxquestions.org/questions/linux-hardware-18/usb-stick-empty-but-200-mb-used-parameters-for-fdisk-786180/)

JZL240I-U 02-01-2010 06:36 AM

USB-stick empty but 200 MB used? Parameters for fdisk?
 
Hi all,

I recently got a 4 GB USB-stick (CBM V88) at a meeting. After removing all files to my hard disk it still had about 200 MB used space! I tried several kinds of deleting what ever that was -- to no avail. So I got furious and zeroed out the first 210 MB with dd and then used fdisk and mkfs to create a new FAT 16 partition (I need the stick to transfer data between windows and linux/bsd).

So far so good. Then I noticed still 4096 kB used space with no file shown :mad: What can be done here?

During fiddling with fdisk parameters heads / sectors / cylinders I noticed that there were something like 5125 blocks of 512 bytes not allocated (which is about 2,5 MB?!?). Can anyone point me to a reference how to calculate an optimized heads / sectors / cylinders count for a stick of the size of 4.108.070.912 bytes or, even better, explain it here for all interested readers?

Thanks for reading this, I'm still fuming...

onebuck 02-01-2010 07:40 AM

Hi,

You can look at the 'Linux File System' section of 'Slackware-Links' to get some useful information.

Basically the filesystem creation does have overhead for pointers to information stored on the device no matter the filesystem type. Look at the links to get a full description of LFS. 'Understanding UNIX / Linux file system' is one but there are other detailed links.

:hattip:

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

JZL240I-U 02-02-2010 06:49 AM

Interesting links, thanks, but that does not really explain what I asked:

Why and how is there a chunk of hidden data on the stick, which refuse to get deleted?

How do I allocate all available memory?

GrapefruiTgirl 02-02-2010 06:53 AM

If there is to be any sort of filesystem at all on the device, there will ALWAYS be space you cannot have; it is used by the device itself, for keeping track of what-all is on the device. There's no way around this, though you *might* look up "Linux Swap File Format" and see if that format would free up more space. BUT: using swap file format will make the device unusable for most purposes.

Alternately, the device could be one of the ones with that Windows U3 "technology" on it, in which case, you would need to use the Windows U3 tools to remove the stuff and free up the space.

Regardless, if there's a filesystem on the device, there will be space you cannot have. Simple as that.

Sasha

JZL240I-U 02-02-2010 07:10 AM

Quote:

Originally Posted by GrapefruiTgirl (Post 3849455)
If there is to be any sort of filesystem at all on the device, there will ALWAYS be space you cannot have; it is used by the device itself, for keeping track of what-all is on the device....

I don't want to nitpicking, but ;) as I understood it in the ext2/3 file systems the file names are stored in the inodes, i.e. structures of the file system itself. In other words the file system infrastructure is part of the files and thus part of my data.

In this case (though I use FAT) I'd expect the physical memory in its entirety to be mapped on the file system plus data. As an aside, 2,5 MB just for file system housekeeping seems to be quite a lot.

Tell you what: I factorized those 4.108.070.912 physical bytes of the stick (= 2^12 * 11 * 73 * 1249). Tonight I'll try to fit those numbers into the allowed ranges of fdisk's parameters and see if and what it brings. I'll report back when I know.

pixellany 02-02-2010 07:30 AM

Quote:

Originally Posted by JZL240I-U (Post 3848187)
So I got furious

:mad: What can be done here?

Thanks for reading this, I'm still fuming...

Getting mad at a USB stick is not going to be productive.......;)


Quote:

Interesting links, thanks, nut that does not really explain what I asked:
Why and how is there a chunk of hidden data on the stick, which refuse to get deleted?
How do I allocate all available memory?
Well, did you read the parts about filesystem overhead?

"2GB" sd card
Reformatted to Linux ext3, partition type 83:
df:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdd1 1952496 35716 1817596 2% /media/disk
fdisk:
/dev/sdd1 1 984 1983712+ 83 Linux

It looks like there are two levels of overhead....

eyemole80 02-02-2010 07:41 AM

Try creating the ext2/3 file system using "-m 0" parameter in mke2fs command. It will further reduce the disk usage overhead.

JZL240I-U 02-03-2010 08:28 AM

Quote:

Originally Posted by pixellany (Post 3849495)
Getting mad at a USB stick is not going to be productive.......;)

I was (and am) mad at those people whose lazyness (stupidity?) wasted 200 MB in the best case and maybe hid something unwholesome in the worst. But then, "dd" be blessed.


Quote:

Originally Posted by pixellany (Post 3849495)
Well, did you read the parts about filesystem overhead?...

Indeed I did and I knew before. But:

Quote:

Originally Posted by pixellany (Post 3849495)
"2GB" sd card
Reformatted to Linux ext3, partition type 83:
df:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdd1 1952496 35716 1817596 2% /media/disk
fdisk:
/dev/sdd1 1 984 1983712+ 83 Linux

It looks like there are two levels of overhead....

Well, I had it lowered to 4 kB. I am still experimenting and be back when I have more results.

pixellany 02-03-2010 04:11 PM

"Wasted 200MB"

With modern drives, you are talking ~ 0.1 % of the total capacity. In my book, it would almost never be worth ANY effort to improve that. Most users will never know--or care--if they are missing 200MB.

onebuck 02-03-2010 04:38 PM

Hi,

Yes, there are times when a penny should be wasted. Forget the penny earned bit!

JZL240I-U 02-11-2010 03:04 AM

Quote:

Originally Posted by pixellany (Post 3851375)
"Wasted 200MB"

With modern drives, you are talking ~ 0.1 % of the total capacity. In my book, it would almost never be worth ANY effort to improve that. Most users will never know--or care--if they are missing 200MB.

Indeed. But it is a waste and a matter of principle for me -- darn, when I first could afford a computer (Atari Mega ST) it hat 1 (!) MB RAM and now we ignore the loss of 200 MB.

And then I never was sure what might be hidden there, because 200 MB inaccessible on a USB stick is more than necessary IMHO.

Lastly, I like to learn :).

JZL240I-U 02-12-2010 04:42 AM

Well. I tried some more configurations. WinXP couldn't read them... So I went back to the defaults of fdisk for a FAT32 (LBA) file system (type "c" AFAIR). Now WinXP sees the stick again. It says 4069 bytes are used of a total capacity of 4.110.741.504 bytes (3,82GB). Linux sees a capacity of 4.118.806.528 bytes, i.e. 8.065.024 bytes more :scratch:

I give up. If anybody knows a link where I can read up on this, I'd be grateful for your posting it here :).

onebuck 02-12-2010 07:28 AM

Hi,

I posted links for a LFS in post #2. I'm sure that Google would provide a source for FAT details.

:hattip:

JZL240I-U 02-22-2010 11:54 AM

Sorry for being back late. And yes, I (re)-read the links. But so far nothing like "formatting USB-sticks for dummies" turned up in google ;)

I can live with what I have, but I'd like deeper insights into the CHS secrets of USB-stick formatting. I'll come back if/when I (ever) find some(any)thing ;).

JZL240I-U 04-01-2010 04:56 AM

I tried it with this:

http://thunk.org/tytso/blog/2009/02/...se-block-size/

Costs 4kB now, which is acceptable and, I think, the usual size of an empty directory ona drive of this size.


All times are GMT -5. The time now is 05:15 AM.