Skip to main content
added 593 characters in body
Source Link
David Anderson
  • 42k
  • 14
  • 67
  • 111

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

I suppose one could instead enter the commands below which would run processes in the background. Afterwards, you could quit the Terminal application while still protecting the drive from being ejected.

cd /Volumes/Data
bash -c 'while true; do sleep 3600; done &'

User Solomon Ucko posted the following question as a comment.

To make this permanent, would there be some way to set this as a startup script?

This subject is well covered elsewhere on Stack Exchange. Some examples are given below.

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

I suppose one could instead enter the commands below which would run processes in the background. Afterwards, you could quit the Terminal application while still protecting the drive from being ejected.

cd /Volumes/Data
bash -c 'while true; do sleep 3600; done &'

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

I suppose one could instead enter the commands below which would run processes in the background. Afterwards, you could quit the Terminal application while still protecting the drive from being ejected.

cd /Volumes/Data
bash -c 'while true; do sleep 3600; done &'

User Solomon Ucko posted the following question as a comment.

To make this permanent, would there be some way to set this as a startup script?

This subject is well covered elsewhere on Stack Exchange. Some examples are given below.

added 279 characters in body
Source Link
David Anderson
  • 42k
  • 14
  • 67
  • 111

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

I suppose one could instead enter the commands below which would run processes in the background. Afterwards, you could quit the Terminal application while still protecting the drive from being ejected.

cd /Volumes/Data
bash -c 'while true; do sleep 3600; done &'

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.

I suppose one could instead enter the commands below which would run processes in the background. Afterwards, you could quit the Terminal application while still protecting the drive from being ejected.

cd /Volumes/Data
bash -c 'while true; do sleep 3600; done &'
Source Link
David Anderson
  • 42k
  • 14
  • 67
  • 111

Open a Terminal application window and enter the following command.

cd /Volumes/Data

This changes the current working directory to /Volumes/Data, which is the root folder of the external drive. If you try to eject the drive, you should get a message stating the drive is in use by the Terminal application.