System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

question about cp -f command

gabriel sztejnworcel
Occasional Visitor

question about cp -f command

Hi,
When I overwrite an existing file using cp -f, will the new file (or a part of it if they are different in size) be written in the same physical place (on the disk)?

Thanks.
1 REPLY
Matti_Kurkela
Honored Contributor

Re: question about cp -f command

That depends on the filesystem and disk being used.

On SSD disks, the wear leveling algorithm built into the disk's flash memory controller makes overwriting the same physical location very unlikely. On regular spinning disks using a traditional filesystem, the answer is more like "maybe, but not explicitly guaranteed".

On something more complex, like a NFS filesystem on a NetApp WAFL (Write Anywhere File Layout), you'll probably have to be a storage system guru to know for sure.

MK
MK