: Is there a way to delete the contents of a partition


mrfoofoo
Apr 28th, 2010, 07:52 PM
Via the terminal while keeping the permissions intact?.

kps
Apr 28th, 2010, 09:12 PM
Why the terminal? Can't you just drag the contents to the trash?

mrfoofoo
Apr 29th, 2010, 12:24 AM
I'd like to clear our partitions in a lab by running a script with Apple remote desktop administrator. So I can't do it from the gui,

I'd like to clear the contents of the partition but keep the permissions intact.

kps
Apr 29th, 2010, 02:27 AM
Try man diskutil in the terminal. It can do pretty much anything, but I do not know how it affects the volumes permissions, but as this will be a script, you should be able to set it up to revert the permissions set to either the default or the original set.

Perhaps just using rm to remove the contents recursively may be simpler.

eMacMan
Apr 29th, 2010, 01:38 PM
Since it sounds like you want an empty partition just use Disk Utility to erase the partition (the volume, not the entire disk).

You can set to ignore or not ignore permissions from the "Get Info" dialog.

This could probably be done via ARD but be very sure you are comfortable using ARD as mistakes when deleting info can be catastrophic with this approach.

IllusionX
Apr 29th, 2010, 04:11 PM
uhh.. you want to delete the content of a partition....

cd /Volumes/(partition2)
rm -Rf *

??

I don't understand what permissions you want to retain on an empty partition?

mrfoofoo
Apr 30th, 2010, 12:53 AM
Thanks for the reply when I delete the contents of the partition I seem to lose the ability to have users write to that drive.

In our environment we are using deep freeze for Mac and Freeze the OS drive so users don't make a mess of things, we allow the users to save files to the d:\ partition but bi-monthly we clear the contents of the D:\

As I said it seems it seems every time I erase the contents of the D:\ I lose the write permission and have to end up resetting it. That is the reason why I would like to find a way to erase the contents of a partition yet still keep the permissions intact.


uhh.. you want to delete the content of a partition....

cd /Volumes/(partition2)
rm -Rf *

??

I don't understand what permissions you want to retain on an empty partition?

polywog
Apr 30th, 2010, 07:45 AM
Thanks for the reply when I delete the contents of the partition I seem to lose the ability to have users write to that drive.

In our environment we are using deep freeze for Mac and Freeze the OS drive so users don't make a mess of things, we allow the users to save files to the d:\ partition but bi-monthly we clear the contents of the D:\

As I said it seems it seems every time I erase the contents of the D:\ I lose the write permission and have to end up resetting it. That is the reason why I would like to find a way to erase the contents of a partition yet still keep the permissions intact.

If you're at the root of the drive you could add chmod 777 `pwd` after the delete. But what are the drive permissions in the first place? And why are you referring to it as "D:\"? Are there also windows users mapping drives to it?

mrfoofoo
Apr 30th, 2010, 10:22 AM
The reference to d:\ is the reminisce of my Windows days sorry.

The permissions on the partition I'd like to delete is everyone had full write access to the drive. What I am trying to avoid is having to reset the permissions after the deletion every time

If you're at the root of the drive you could add chmod 777 `pwd` after the delete. But what are the drive permissions in the first place? And why are you referring to it as "D:\"? Are there also windows users mapping drives to it?

polywog
Apr 30th, 2010, 11:18 AM
The reference to d:\ is the reminisce of my Windows days sorry.

The permissions on the partition I'd like to delete is everyone had full write access to the drive. What I am trying to avoid is having to reset the permissions after the deletion every time

Gotcha, just wanted to make sure that Windows wasn't somehow fudging the permissions somehow. Sadly I don't have a spare drive to test with, but I have a few questions.

Who's the owner (username and group)?
What are the exact permissions before? All of them, including special modes.
Also, the same two questions for the parent directory.
Is the drive local (to the machine you're executing the script on?)

mrfoofoo
Apr 30th, 2010, 12:51 PM
We autologin the students locally as admin and they have read and write access to the scratch partition to save any files. They work with some huge animation files etc.

The OSX partition has a program called deep freeze installed on it, so they student can't mess up the operating system partition, because any change they make is gone once they reboot.

The permissions before the deletion of the scratch partition is read and write for the admin users, which all the students are because we autologin as admin.

After the deletion of the scratch drives I always have to redo the permissions.