What would happen to a filesystem upon using quick format on the previous one?
I have an SSD, say for example I completely delete the windows partition and merge it with my linux partition, what would happen to the data that the NTFS filesystem was pointing to? Given that the ext4 partition has no reference to that data, will it be able to TRIM the old data or it will stay lingering until an overwrite occurs?
What happens to a filesystem upon a quick format on an SSD?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
What happens to a filesystem upon a quick format on an SSD?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: What happens to a filesystem upon a quick format on an SSD?
A quick format in the sense of
mkfs
of an ext4 filesystem would in fact by default trim immediately; see man mke2fs
, the -E discard
option description. However, you have nothing to worry about anyway even if it would not; what fstrim
(set up by default weekly in Ubuntu/Mint) does is trim the space that the filesystem finds to not be in use: even if the format wouldn't have trimmed things already certainly what it does quite by design is reset all filesystem structures pointing to any old data, meaning that the first regular fstrim discards them at that level; nothing "stays lingering".Re: What happens to a filesystem upon a quick format on an SSD?
It seems that windows behaves differently in this scenario. I used a recovery tool and found lingering files on my windows partition from almost a year, and trimming does nothing to them (These are likely the remains of a previous windows installation). I want to get rid of them because soon I will be done with windows and will delete its partition and extend the mint one.
Will a full format overwrite this mess caused by windows?
Re: What happens to a filesystem upon a quick format on an SSD?
The first
A nonquick format, i.e., one that overwrites, is only guaranteed to be effective if you overwrite the entire drive: an SSD's logical sector map is a mere software construct with the SSD deciding which physical block some given logical one points to at any given time, and specifically due to the SSD then not needing to slow-erase a block before it writes new data to "that same block": it just maps an already erased block in its place and writes to that.
Anycase, first sentence above seems most relevant, but overwriting all free space on the entire drive certainly works. You can do this also with e.g.
to overwrite all free space on the filesystem mounted on /where/ever/ with zeroes. Remove the "zero" files only after all filesystems on that same drive have been filled in that manner, again due to the above.
fstrim
after said extend will grab them so frankly it seems you'd need to do exactly nothing even I'd take as given that a Windows-sides TRIM would leave blocks not invalidated (which I don't really but oh well).A nonquick format, i.e., one that overwrites, is only guaranteed to be effective if you overwrite the entire drive: an SSD's logical sector map is a mere software construct with the SSD deciding which physical block some given logical one points to at any given time, and specifically due to the SSD then not needing to slow-erase a block before it writes new data to "that same block": it just maps an already erased block in its place and writes to that.
Anycase, first sentence above seems most relevant, but overwriting all free space on the entire drive certainly works. You can do this also with e.g.
Code: Select all
sudo dd if=/dev/zero of=/where/ever/zero bs=1M
Re: What happens to a filesystem upon a quick format on an SSD?
I think this is just a side effect of some files staying after reinstalling windows which destroyed old filesystem and left some files with no reference to be trimmed. Some of these files was partially overwritten according to the tool.
If fstrim will grab the loose files and trim them then thats great!
One more question: Can fstrim TRIM a windows partition?
Re: What happens to a filesystem upon a quick format on an SSD?
Well, that's the point then more or less; fstrim does not trim "them", does not trim files but trims free space, trims "nonfiles" if you will. As such all that's needed for fstrim to tell the SSD firmware that some logical blocks are unused are for said blocks to not be part of a file or some filesystem-structure according to that filesystem.
This would be not different on Windows either and moreover, while TRIM itself would not (necessarily) cause an erase of a physical block or at the very least not immediately certainly it should cause further reads from that physical block to no longer retrieve the former data due to it having been marked invalid, so frankly I'm having trouble piecing together a situation where TRIM reportedly didn't.
Anycase. Yes, first run of e.g.
As to your specific question (which I saw only a little later); yes, as far as I can see NTFS-3G (which is on Ubuntu/Mint used as the NTFS filesystem "driver") supports fstrim since NTFS-3G 2015.3.14, apparently since Ubuntu 16.04/Mint 18.
This would be not different on Windows either and moreover, while TRIM itself would not (necessarily) cause an erase of a physical block or at the very least not immediately certainly it should cause further reads from that physical block to no longer retrieve the former data due to it having been marked invalid, so frankly I'm having trouble piecing together a situation where TRIM reportedly didn't.
Anycase. Yes, first run of e.g.
fstrim -av
after you have expanded your Linux filesystem to include the space formerly occupied by the Windows filesystem is going to cause all not actively used space on said expanded Linux filesystem to be trimmed; to be marked free, and as such nothing from that former Windows filesystem should after that be able to be retrieved on a normal, software level; it'll all be gone.As to your specific question (which I saw only a little later); yes, as far as I can see NTFS-3G (which is on Ubuntu/Mint used as the NTFS filesystem "driver") supports fstrim since NTFS-3G 2015.3.14, apparently since Ubuntu 16.04/Mint 18.
Re: What happens to a filesystem upon a quick format on an SSD?
Thanks for your time and valuable information!rene wrote: ⤴Sat Jun 19, 2021 1:19 pm Well, that's the point then more or less; fstrim does not trim "them", does not trim files but trims free space, trims "nonfiles" if you will. As such all that's needed for fstrim to tell the SSD firmware that some logical blocks are unused are for said blocks to not be part of a file or some filesystem-structure according to that filesystem.
This would be not different on Windows either and moreover, while TRIM itself would not (necessarily) cause an erase of a physical block or at the very least not immediately certainly it should cause further reads from that physical block to no longer retrieve the former data due to it having been marked invalid, so frankly I'm having trouble piecing together a situation where TRIM reportedly didn't.
Anycase. Yes, first run of e.g.fstrim -av
after you have expanded your Linux filesystem to include the space formerly occupied by the Windows filesystem is going to cause all not actively used space on said expanded Linux filesystem to be trimmed; to be marked free, and as such nothing from that former Windows filesystem should after that be able to be retrieved on a normal, software level; it'll all be gone.
As to your specific question (which I saw only a little later); yes, as far as I can see NTFS-3G (which is on Ubuntu/Mint used as the NTFS filesystem "driver") supports fstrim since NTFS-3G 2015.3.14, apparently since Ubuntu 16.04/Mint 18.