Does moving a file/folder causes fragmentation in Disk on Ubuntu 20.04?
Asked
Active
Viewed 230 times
2 Answers
4
In this article on Quora 'Does disk fragmentation occur in Linux? If not, why?' it explains that Linux (EXT4) does not fragment any disk. Windows however will (FAT 32/NTFS).
Fragmentation only happens on HDDs (the ones with platters and readheads in them).So you can defrag them once in a while for better performance.
Fragmentation does not happen on SSDs. Don't perform a defragmentation on these kind of disks. It is useless and the read/writes shorten its lifespan.
So it really depends on what kind of disk(s) you have in your system and what filesystem you use.
-
NVMes are a specific kind of controller interface for Solid State Drives (SSDs). The other kind of controller interface for SSDs and HDDs are called SATA. There is nothing called SDD. – user68186 Mar 01 '22 at 14:50
-
@user68186 Thanks for editing my answer. And youŕe right about the controllers SATA and NVME. – Joepie Es Mar 01 '22 at 15:47
2
moving a file with the mv
command on the same disk does not move data. It changes only the directory entries relating to this data. Hence, it cannot fragment a disk.

Bruni
- 10,542
-
2Moving within same partition / filesystem does not move data physically. Moving between partitions / filesystems does !! – Soren A Mar 01 '22 at 15:12
-
@SorenA Thank you. I am well aware of thatm, but will clarify. Moving between partitions is a smaller problem with regard to fragmentation in any case...Oh I just saw, I already had mentioned it (...I write on the same disk) – Bruni Mar 01 '22 at 15:16
-
You are wrong. Why are moving between partitions on same disks a smaller problem than movin between disk in relation to fragmentation ? – Soren A Mar 01 '22 at 15:18
-
@SorenA You are right on this. I made a logical mistake on this. The answer is correct though, even if not complete. – Bruni Mar 01 '22 at 15:22
-
Thanks everyone for information. I'm new to Linux and Ubuntu. I want to know whether drag-and-dropping a file/folder works in a similar way (does it only changes the directory entries) as using
mv
command does. – Mar 01 '22 at 15:58 -
@ByteManager I am not sure about drag and drop (it is not in my workflow). Cut and paste on the same partition works like move (at least on KDE) – Bruni Mar 02 '22 at 07:27