Re: Signed and unsigned int

From: Gordon Burditt (gordonb.xpsjv_at_burditt.org)
Date: 08/11/04


Date: 10 Aug 2004 22:34:31 GMT


>A signed int can contain up to 2Gig, 2 147 483 648, to be exact.

I know of no system where this is the limit. A 32-bit signed int
cannot contain 2 147 483 648. It can contain 2 147 483 647. It
is not guaranteed that a signed int has more than 16 bits, nor is
there anything preventing it from having 47 or 128 bits.

>Since The Mars rovers landed, I have been storing the
>photographs in two directories, Spirit and Opportunity. I had
>more than 18 000 files in a single directory. Without being
>aware of it, I crossed the 2 147 483 648 border last week.
>
>Nothing happens, if you do not attempt to read all files in the directory,
>or even worst, copy them to another drive.

Most of the problems I have heard of involve having a SINGLE FILE
containing more than 2GB, or 4GB. I hope there is not much software
in use where a whole disk drive is constrained by size limits of
2GB or 4GB. I don't understand why there is a limit on reading a
bunch of files in a directory (unless you were copying them into a
single file, e.g. with tar or cpio) rather than a limit on individual
file size or disk partition size.

A reasonable OS will not let you write a file beyond the limit,
rather than corrupting the file system, whatever that limit is,
even if it's something huge like 512YB.

>Worried by mysterious disk errors, I tried to save my work. When making
>the copy however, there was an error when the copy arrived at an image
>and could not read it.
>
>Foolish me, I tried to copy the file again.
>
>That was it: the disk started to make a periodic mechanical noise, and
>it was GONE ALONG WITH ALL MY DATA IN THE DISK!!!!!!!!!!!!!!!!!!!!!

I'm sorry about your lost files but I'm not entirely convinced that
copying too much at once is the reason you lost them.

>Why?
>
>When a signed integer is increased beyond 2147483648, it becomes NEGATIVE.
>This means that the system will issue a NONSENSE movemevent order to the
>read heads, destroying the disk instantly.

A reasonable OS will not issue such an order to the disk drive.
The driver should range-check the values it is computing and object
if the values are out of range. So, for that matter, should the
disk drive. Disk drives nowadays are much smarter than the old
mechanical floppy drives where you could keep stepping and slam the
heads into things.

>I was lucky. I had a full backup of the mars data in my linux system. Ahh
>Microsoft.
>I fired up the linux machine running ext2 file system. I issued the order to
>copy
>the files, and started doing other things during the copy.
>
>When the amount of data transmitted arrived at approx 2GB, I heared with
>horror that
>the disk started doing the SAME repeating mechanical noise and my linux
>system
>WAS GONE, I HAVE LOST several months of work without any means of getting
>my data back.
>
>Signed integer can contain up to 2147483648 bytes. Not a single byte more.
>
>I have developed a compile time switch to check for overflows within
>lcc-win32 and
>posted here a message, several weeks ago. Nobody cared to answer.
>
>SHIT !!!!!!!!!!!
>
>C is a nice language in which to write file systems. But IT WOULD BE BETTER
>TO
>BE CAREFUL WITH THOSE "int" s OK?
>
>You do not believe me?
>
>Try it. Make several directories with several thousand files of 100-200K
>each, until
>you get more than 2GB.

I routinely make single files that are greater than 4GB on FreeBSD.
(The size of a burnable DVD image is about 4.7GB if you pack things
to use the maximum capacity. I'm using DVDs to store DATA, not
video or audio. The number goes up if your DVD supports double-sided
or blue-laser DVDs) Yes, I've got some directory trees somewhat
like what you describe, only the total is 22GB (most of it downloaded
with a single multi-file FTP command). Yes, there's a backup of
it on another system as a single 22GB tar file. I need to split
it up into chunks small enough to burn on DVDs. (actually, I've
done this several times, but I don't like how the files end up
getting split - I want related files on the same disk. I do need
to check the program that does the splitting, but I think it's using
off_t's for holding file lengths (64 bits on FreeBSD)). After I do
that, the program that makes a DVD image is essentially a copy
program that puts all the files in one big file (with assorted
headers & stuff). I have had no problems.

I believe I have done this on Linux also, even old versions of Linux
(think TiVo's OS - was that built in 1996?) only supporting LBA32
and not LBA48 (meaning Linux won't support DRIVES larger than 137GB
or so). Modern versions of Linux don't have that limit.

                                                Gordon L. Burditt



Relevant Pages

  • dvd sees blank dicks as full and can not write
    ... My computer has started seeing any blank disk as full. ... burner and they both act the same way. ... from windows xp explore all the disk drives are properly labeled as ... dvd-rw, but when Iput afresh blank dvd in the disignation changes to ...
    (sci.electronics.repair)
  • Re: DVD drive - DELL issue?
    ... I bought a DVDRW burner to replace the DVD drive that came with my dell. ... needed it to burn to disk the video clips from my new camera. ... movie player) or media player. ...
    (microsoft.public.windowsxp.hardware)
  • Creating HD-DVDs and Blu-ray disks with TivoToGo using DVD media
    ... You can create HD-DVD and Blu-ray compatible disks in a matter of minutes using high-definition recordings transferred from the TivoHD or Series3. ... You can do this because both high-definition formats support high-definition playback from DVD media. ... From the "Create Video Disk" dialog, ...
    (alt.tv.tech.hdtv)
  • Re: DVD burning advice sought
    ... I have a Sony DVD burner for a PC hardly used as the thing was very fussy ... I checked the Sony website fot a firmware update for this piece ... After coastering several DVDs ("the disk ... I wind up either with a coaster or a disk that will play in the RDR-VX515 ...
    (rec.video)
  • Re: BluRay - HD DVD war over?
    ... universal "Multilayer Dual Optical Disk" that can store BluRay video; ... DVD video; and standard DVD programs. ... On reviewing the patent application more carefully, however, it remains to be seen whether or not this is good technology, and whether it could ever be commercialized. ...
    (rec.video.dvd.tech)