LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Getting Rid Of Hard Drive? (https://www.linuxquestions.org/questions/linux-hardware-18/getting-rid-of-hard-drive-519839/)

carlosinfl 01-16-2007 11:08 AM

Getting Rid Of Hard Drive?
 
OK - I am selling my one and only hard drive which is what my Linux partition is built on.

Code:

cwilliams@stormshadow:~$ sudo df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/stormshadow-root
                      227G  5.5G  210G  3% /
tmpfs                507M    0  507M  0% /lib/init/rw
udev                  10M  68K  10M  1% /dev
tmpfs                507M    0  507M  0% /dev/shm
/dev/sda1            236M  22M  202M  10% /boot

The drive is a Western Digital 250GB S-ATA drive. How do I release this drive to stranger and get all the information of it being my only disk? Should I just boot from my Debian disk and run the installer as a fresh install or is there something else I can do?

FnordPerfect 01-16-2007 11:33 AM

Sorry, I didn't quite get what you are up to. I'm confused by this getting-rid expression...

do you want to
a) get all information of it, as in transfering it to a new disk, or
b) get all information off it, as in giving it to a stranger completely empty?

I suppose, you are going to give your old hard drive away and want to transfer the information on it to a new harddrive? Is this it?

Then, you probably don't need to rerun the installer at all. Your partition setup is pretty straight-forward, shouldn't be much of a hassle.

Just
* connect your new drive
* boot from your old hard drive
as root
* recreate both of your data partitions ( / and /boot) with cfdisk on the new harddrive
* create the file systems with mkfs -t ext3
* mount them somewhere (e.g., /mnt/new-hd and /mnt/new-hd/boot)
* copy the content from the old one there with cp -xRp / /mnt/new-hd and cp -xRp /boot /mnt/new-hd/boot
* After that, update /mnt/new-hd/etc/fstab if necessary
* Don't forget to reconfigure and install the boot loader on the new drive's MBR.
* Switch hard drives
* Pray that I didn't tell bullshit here

If both drives have the same dimensions, you could just "clone" them with the dd utility.

Hope that helps

~fab

carlosinfl 01-16-2007 11:38 AM

No - I am selling my drive and I have uploaded all my data to a secure NFS on my LAN. I am scared someone will be able to access the drive data and any sensitive information I have on it.

When I release the drive to the new owner, how do I make sure the drive is wiped and the data would be gone or hard to recover? I understand to some degree there is always a way to recover data depending on who and how bad they want it. What is the best process for wiping the one & only drive I have on my system?

I tried booting with Knoppix 3.6 (old) and it has a app called "QtParted" which did not work as I am still booting from the system and posting from it now. Everything is still here.

stress_junkie 01-16-2007 11:46 AM

I would boot a live Linux CD and use shred to overwrite the entire drive.
Code:

shred -v /dev/sda
That will overwrite the entire disk with random data 25 times. You may be satisfied with having the disk overwritten once. The shred man page has more information about the parameters that control its behavior.

Some Linux distributions may not have shred but do have a similar utility called wipe. If all else fails you could use the dd utility.
Code:

dd if=/dev/urandom of=/dev/sda bs=25K count=10G
dd works fastest if you keep the bs parameter small and allow that to reiterate many times via the count parameter.

michaelk 01-16-2007 11:55 AM

Reformatting and reinstalling will not really erase all of your personal data from the disk. Overwriting the disk with multiple passes with alternating ones and zeros via the dd command will pretty much keep all but the professional data recovery people from finding any real info.

pljvaldez 01-16-2007 11:59 AM

Quote:

Originally Posted by Carlwill
How do I release this drive to stranger and get all the information of it being my only disk? Should I just boot from my Debian disk and run the installer as a fresh install or is there something else I can do?

I don't understand your question. Do you want to get the information off of it and then securely wipe it of your personal info?

If that's what it is, burn your info to CD/DVD that you want to keep. Then reboot with a Knoppix CD and type shred -z -v -n 10 /dev/sda. This will overwrite the drive 10 times with different combinations of data and then a final pass with all zeros. If you're really paranoid, you can leave off the "-n 10" and it defaults to like 25 times or some large number (just be prepared to wait a day for it to finish).

EDIT: Late to the game as always! :D BTW after you finish shredding the drive, you can see just how good of a job you did by running a forensic program on the drive like foremost or photorec and see if it comes back with any real data.

carlosinfl 01-16-2007 04:45 PM

Yes - I just want to destroy all data on the disk. I know how to back up everything fine but I don't want my resume, tax info, SS#, and everything else I have on my Linux box being recovered by some 17 year old kid.

jschiwal 01-16-2007 04:49 PM

You could download Darik's Boot and Nuke.
http://dban.sourceforge.net/

carlosinfl 01-16-2007 06:11 PM

So I just booted into Knoppix for fun and I for some reason can't understand why I am unable to browse my drives data from a Live CD?

Code:

knoppix@Knoppix:~$ sudo su -
root@Knoppix:~# cd /media/
root@Knoppix:/media# ls
cdrom  fd0  hd  hda  hdb  sda1  sda5  test
root@Knoppix:/media# cd sda1
root@Knoppix:/media/sda1# ls
root@Knoppix:/media/sda1# ls -la
total 2
drwxr-xr-x  2 root root 1024 Jan 16  2007 .
drwxr-xr-x 10 root root 1024 Jan 16  2007 ..
root@Knoppix:/media/sda1# cd ..
root@Knoppix:/media# ls
cdrom  fd0  hd  hda  hdb  sda1  sda5  test
root@Knoppix:/media# cd sda5
root@Knoppix:/media/sda5# ls
root@Knoppix:/media/sda5# ls -la
total 2
drwxr-xr-x  2 root root 1024 Jan 16  2007 .
drwxr-xr-x 10 root root 1024 Jan 16  2007 ..

It shows nothing on the 2 mounted /dev/sda drives.

What am I missing. I want to see something there before I scrub it clean.

pljvaldez 01-16-2007 06:14 PM

Were they mounted or just recognized and mount points were created? I'm guessing /etc/fstab has the "noauto" option. Try mount /dev/sda1...

carlosinfl 01-16-2007 06:17 PM

OK - that worked but as you can see my data seems to be on the /dev/sda5 partition and the same command that worked for sda1 does not for sda5, why?

Code:

root@Knoppix:/media/sda5# cd /
root@Knoppix:/# mount /dev/sda1
root@Knoppix:/# cd /dev/sda1
-su: cd: /dev/sda1: Not a directory
root@Knoppix:/# cd /media/sda1
root@Knoppix:/media/sda1# ls
System.map-2.6.17-2-k7  initrd.img-2.6.17-2-486.bak  lost+found
config-2.6.17-2-k7      initrd.img-2.6.17-2-k7      vmlinuz-2.6.17-2-k7
grub                    initrd.img-2.6.17-2-k7.bak
root@Knoppix:/media/sda1# mount /dev/sda5
mount: you must specify the filesystem type


pljvaldez 01-16-2007 06:20 PM

Maybe sda5 isn't in fstab? cat /etc/fstab

carlosinfl 01-16-2007 06:24 PM

Code:

root@Knoppix:/media/sda1# cat /etc/fstab
/proc      /proc      proc  rw,nosuid,nodev,noexec 0 0
/sys      /sys        sysfs  rw,nosuid,nodev,noexec 0 0
/dev/shm  /dev/shm    tmpfs  rw,nosuid,nodev,noexec 0 0
/dev/pts  /dev/pts    devpts mode=0622          0 0
/dev/fd0  /media/fd0  auto  user,noauto,exec,umask=000    0 0
/dev/cdrom /media/cdrom  auto  user,noauto,exec,ro 0 0
/dev/hdb /media/hdb  auto  users,noauto,exec,ro 0 0
/dev/hda /media/hda  auto  users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/sda1 /media/sda1 ext3 noauto,users,exec 0 0
# Added by KNOPPIX
/dev/sda5 /media/sda5 auto noauto,users,exec 0 0

To me it looks fine. Perhaps I need to add another string to the "mount" command so it knows how to mount it or something like that? I obviously will need to "umount" sda5 when I am done looking at it so I can shred it.

pljvaldez 01-16-2007 06:25 PM

What type of filesystem is it (fdisk -l)? Change the "auto" to the right filesystem type.

carlosinfl 01-16-2007 06:26 PM

Code:

root@Knoppix:/media/sda1# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          31      248976  83  Linux
/dev/sda2              32      30401  243947025    5  Extended
/dev/sda5              32      30401  243946993+  8e  Linux LVM

Ah - yes, I did an LVM partition on that when I installed it. It has been some time ago...What do I do to view this LVM?


All times are GMT -5. The time now is 10:19 AM.