Why Device or resource busy whent to remove the file?

Posted on

Problem :

/dev/sda4 is in ntfs file system ,and mounted on /mnt/winntfs with ntfsusermap(the most key point),the post list how to mount ntfs in linux step by step.

how to mount ntfs in linux step by step

sudo cp -r  mydoc  /mnt/winntfs
ls  /mnt/winntfs
ls  /mnt/winntfs/mydoc
analyse  build  cron

You can see that i have copied all content in $HOME/mydoc into /mnt/winntfs/mydoc,now i want to remove /mnt/winntfs/mydoc.

sudo rm -rf  /mnt/winntfs/*
rm: cannot remove '/mnt/winntfs/mydoc': Device or resource busy
lsof | grep -i  "mydoc"
lsof | grep -i  "/mnt/winntfs/mydoc"

I want to get the process id number with lsof,and kill the process with id number ,then maybe remove it,but lsof command get nothing,why it can be copied some directory ,instead of removing it?How can i remove it ?

Solution :

Device or resource is busy because partition is still mounted.
You have to unmount the partition before removing the partition.
Opened terminal and run:

sudo umount -f  /mnt/winntfs/mydoc
sudo rm -rf  /mnt/winntfs/*

Leave a Reply

Your email address will not be published. Required fields are marked *