Re:How do I delete bytes from the beginning of a file? (2010)
by throwaway98434 on Wednesday June 05, 2019 @07:11PM
(#20110041)
The unix filesystem api doesn't provide a way to interact with sectors. The primitives are files and the methods available are writing more data, or truncating.
There is no function provided for shifting the byte offset of data in a file.
You can write an entirely new file, of course, but the question has an implicit goal of doing this efficiently.
Re:How do I delete bytes from the beginning of a file? (2010)
by maxxxxx on Wednesday June 05, 2019 @07:00PM
(#20109979)
Does the whole sector thing still make sense for SSDs? Do they still work by sector or can every byte be addressed directly?
Re:How do I delete bytes from the beginning of a file? (2010)
by pstrateman on Wednesday June 05, 2019 @07:09PM
(#20110029)
The "native" sector size of an SSD is the erasure block size, typically 64KiB.
Re:How do I delete bytes from the beginning of a file? (2010)
by vardump on Thursday June 06, 2019 @05:05AM
(#20112797)
I'm fairly sure SSD erase block sizes are more like 2 MB or more. Even 8 MB wouldn't surprise me anymore.
Re:How do I delete bytes from the beginning of a file? (2010)
by rpearl on Wednesday June 05, 2019 @07:09PM
(#20110030)
current SSDs are page/block oriented, but that's likely to change. (See intel's relatively recent Optane).
Re:How do I delete bytes from the beginning of a file? (2010)
by Thorrez on Thursday June 06, 2019 @01:05AM
(#20111743)
Only the last sector is allowed to be partially filled. Every other sector must be fully filled.
Re:How do I delete bytes from the beginning of a file? (2010)
by tom_ on Wednesday June 05, 2019 @06:48PM
(#20109906)
Each sector is a fixed size.
Re:How do I delete bytes from the beginning of a file? (2010)
by memling on Wednesday June 05, 2019 @06:53PM
(#20109930)
At first blush, I don't think this would work quite right because the last ten bytes of the sector would have some content (e.g., zero bytes or some other data from the original sector).
Re:How do I delete bytes from the beginning of a file? (2010)
by gnulinux on Wednesday June 05, 2019 @06:59PM
(#20109969)
What happens to the last 10 bytes of that sector?
Re:How do I delete bytes from the beginning of a file? (2010)
by mehrdadn on Wednesday June 05, 2019 @06:46PM
(#20109891)
You'd have to do this for every sector in the file or increase potential fragmentation. Alternatively they could support an offset in the beginning, but it might wear out the decide much faster due to lack of alignment. In either case though I feel the capability would be nice to have regardless...
Edit: then delete the last ten bytes.