Deleting hard disk entirely, from Unix

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
My mbp has a serious problem and cannot boot or proceed to a normal osx startup.
I can only get into unix, pressing command-s during startup.
From this unfriendly(for me) environment, I want to find a way to completely delete the hard disk, before I sell my mbp for spare parts.
I don't want to give the ssd with my personal information inside it, at least I want to trash everything and disappear anything from my data.

Last time I tried to type some commands, I remember having several 'denies' from system, due to permissions matters, as I just got into unix, I am not administrator or anything like that.
But, I think I should have a way to delete my files.

So please give me all the alternative ways, commands, pathways, to be able, in any case, to proceed to extermination of my files inside the internal mbp disk. I 'll write them down, and I will try them all.
I hope that some of these commands could do the job.
 

Fishrrman

macrumors P6
Feb 20, 2009
17,160
5,521
How old is the MBPro?

Have you thought about replacing the internal hard drive?

It may have years of life left...
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
There is a logic board failure. MBP 15' early 2011...
I can't repair it, it costs too much, it doesn't reserve it.
I am thinking of selling it 'as is'.
But I want to delete my files from hard disk.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
29,132
8,805
California
You should be able to use Internet recovery with that machine. Just hold command-option-r (all three keys at once) when you boot to get to the recovery screen. From there just use Disk Util to erase the drive.
 

smithrh

macrumors 68020
Feb 28, 2009
2,463
833
Or, you could just physically remove the drive entirely if you can't boot far enough to follow Weasleboy's suggestion.

You could just keep the drive, or smash it, or hook it up to an enclosure to re-use it...
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
You should be able to use Internet recovery with that machine. Just hold command-option-r (all three keys at once) when you boot to get to the recovery screen. From there just use Disk Util to erase the drive.
Even internet recovery failed.

----------

Or, you could just physically remove the drive entirely if you can't boot far enough to follow Weasleboy's suggestion.

You could just keep the drive, or smash it, or hook it up to an enclosure to re-use it...
I don't have an ssd enclosure, I am not going to buy one for this task.
 

Fishrrman

macrumors P6
Feb 20, 2009
17,160
5,521
[[ I don't have an ssd enclosure, I am not going to buy one for this task. ]]

Wasting what is probably a perfectly good computer because you don't want to change out the drive.

It's your money, do what you want...
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
I gave my mbp to an authorized apple service.
They told me it is a logic board problem.
It is not about change out drive.
 

smithrh

macrumors 68020
Feb 28, 2009
2,463
833
I would start with "sudo rm -rf /*"
Using that method will possibly result in recoverable files. I haven't tried anything like DiskWarrior on an SSD, but all 'rm' will do is remove the pointer to the data.

If it were me, I'd take the drive out and then sell whatever is left. I am assuming the OP is looking for info security.
 

boast

macrumors 65816
Nov 12, 2007
1,369
739
Phoenix, USA
Using that method will possibly result in recoverable files. I haven't tried anything like DiskWarrior on an SSD, but all 'rm' will do is remove the pointer to the data.

If it were me, I'd take the drive out and then sell whatever is left. I am assuming the OP is looking for info security.
Ah, right. Should be srm instead of rm
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
sudo srm -rf /*

As I said I just get into unix, I have not found any way to gain administrator privileges.
So, will this command work, or I will see 'denied' by system?
 

bradl

macrumors 601
Jun 16, 2008
4,006
11,823
sudo srm -rf /*

As I said I just get into unix, I have not found any way to gain administrator privileges.
So, will this command work, or I will see 'denied' by system?
Better than that. Do a 'df' to see what filesystems you have mounted.

From that, do a 'sudo cat /dev/zero > /dev/disk0' where "/dev/disk0 is your first disk holding your / partition.

Or, you could do a "sudo dd bs=8192 if=/dev/zero of=/dev/disk0 count=1" (again, where /dev/disk0 is your first disk). Both will zero out your disk, whereas dd could also get your boot sector.

Ultimately, if it works for OS X (not sure why it wouldn't since it is x86 based), you could go grab DBAN (Dave's Boot And Nuke) and completely wipe your drive, from a simple basic reformat, to multiple runs across your disk, to DoD standard wiping.

BL.
 

smithrh

macrumors 68020
Feb 28, 2009
2,463
833
sudo srm -rf /*

As I said I just get into unix, I have not found any way to gain administrator privileges.
So, will this command work, or I will see 'denied' by system?
You can simply try it.

If it asks you for a password, supply the password for the machine.

Perhaps I should ask another question:

What are you trying to do? Protect your personal information, or something else?
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
Ι want to empty the disk, before I sell the machine.
But as I said it does not boot to osx (due to logic board failure), so I have to do it from unix.
 

smithrh

macrumors 68020
Feb 28, 2009
2,463
833
I know that - but why?

Personal information?

There are things you can do without sudo, such as removing all of the content in your home directory - actually, all user directories.
 

bradl

macrumors 601
Jun 16, 2008
4,006
11,823
Ι want to empty the disk, before I sell the machine.
But as I said it does not boot to osx (due to logic board failure), so I have to do it from unix.
If you seriously want to sell it without any way of recovering any other data, I would definitely suggest DBAN. at least a 2 or 3 pass wipe of your drive with something more than just the simple format algorithm, and you should be good to go.

BL.
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
I know that - but why?

Personal information?

There are things you can do without sudo, such as removing all of the content in your home directory - actually, all user directories.
There are personal files inside disk. Not crucial ones, but even my family's photos, I don't want to be in everyone's hands.

I do not know about all these in unix environment, so it would be helpful if you could give me 'plain lines' with the right commands, just to type in.

At this moment, I am waiting to get back my mac from service, but I want to be able to make the deletion immediately after I get it back.
I made some tries before giving it to service, with some commands I found on internet, but with no luck.
I remember, the system did not allow me to delete files.
So, I gave it to them, as is.
But now I 'm gonna sell it.

So, I want to write all the commands you tell me, to be ready to apply them.

As I said, I am locked out my system, and I can't imagine that I have no choice to complete my erasing tasks using the only option left, unix.

Please help me to write down all the alternative commands, bypassing permissions problems, in order to make the deletion with some way.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
29,132
8,805
California
There are personal files inside disk. Not crucial ones, but even my family's photos, I don't want to be in everyone's hands.

I do not know about all these in unix environment, so it would be helpful if you could give me 'plain lines' with the right commands, just to type in.
You will not be able to erase the entire disk because you are booted to that very disk in single user mode. You should be able to delete specific folders though.

First run this command to mount the disk.

Code:
mount -uw /
How many user accounts are there? Try this to delete the entire user account substituting the real account name for "accountname".

Code:
sudo rm -rf /Users/accountname/*
I'm not sure if it will let you kill the entire account this way.

If it won't, drill down and delete the specific folders you know hold the data. Do the same for Music, Photos, Movies folders etc.

Code:
sudo rm -rf /Users/accountname/Documents/*
Do you have access to another Mac temporarily? You could use this tool from Apple with a 1GB or larger USB key to make a recovery key, then option key boot your Mac to that key and use Disk Util to erase.
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
I discussed these matters with a friend, and he told me that I should try write:
su
to be able to manage everything as 'root'.
I never dealt with such thing while in osx.
Which is supposed to be the root password?
Can I guess there is a default one?
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
29,132
8,805
California
I discussed these matters with a friend, and he told me that I should try write:
su
to be able to manage everything as 'root'.
I never dealt with such thing while in osx.
Which is supposed to be the root password?
Can I guess there is a default one?
su is the same as the sudo command I gave you. By default your own admin account password is added to the root level password list.

So entering "sudo whatever_command" then return will prompt for your admin password then execute that command as root.
 

Fishrrman

macrumors P6
Feb 20, 2009
17,160
5,521
Why not just take the existing hard drive OUT of the Macbook, and replace it with another, even an empty one?
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
Why not just take the existing hard drive OUT of the Macbook, and replace it with another, even an empty one?
Because I do not have a spare ssd to do it.

----------

su is the same as the sudo command I gave you. By default your own admin account password is added to the root level password list.

So entering "sudo whatever_command" then return will prompt for your admin password then execute that command as root.

I just had a default 'macuser' account, and a password for this account.
That's all.

What is the 'root'/admin password in my mac? That I don't even know it?
 

cool11

macrumors 65816
Original poster
Sep 3, 2006
1,450
125
I tried most of the things you told above.
And other ones I found on internet.
Nothing worked.
It does not ask me for password in any case.
'Deny' or 'read-only' in most cases.
My last chances is to be able to boot from live cd/usb with linux, so that I could have control to delete anything I want.
Trying it inside mac's unix seems useless.
The only constraint is that it should be text-based, with no graphics at all, since the problem of my mac does not allow any graphics.
Just in case you have some idea about it, here is the other topic
http://forums.macrumors.com/showthread.php?t=1723293
I need a way to achieve it.