problem cleaning up old drive
Hakan Koseoglu
hakan.koseoglu at gmail.com
Fri Nov 21 16:41:43 UTC 2008
Nepal,
On Fri, Nov 21, 2008 at 4:30 PM, nepal google
<nepal.roade at googlemail.com> wrote:
> I have a 40gb hda drive that I want to completely erase and
> try to re-use following the problems I've had and reported
> to the list.
If you are destroying the disk, use DBAN or similar.
> The snag is that the swap drive is on that drive, not on the
> hdb that I am using presently.
Here's a method:
My dinky server has 2GB RAM and 3GBish Swap.
root at jupiter:~# free
total used free shared buffers cached
Mem: 1997928 1953024 44904 0 10476 1371172
-/+ buffers/cache: 571376 1426552
Swap: 3229024 880 3228144
First, create a swapfile (like goode olde Windows):
root at jupiter:~# dd if=/dev/zero of=/swapfile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 18.7898 s, 57.1 MB/s
Which will create a 1GB file.
Create a swapfile on this file:
root at jupiter:~# mkswap /swapfile
Setting up swapspace version 1, size = 1073737 kB
no label, UUID=ff64d8bd-b03a-4a12-a4ea-3e9e0ea19aea
Brilliant. Turn on the swapfile:
root at jupiter:~# swapon /swapfile
root at jupiter:~# swapon -s
Filename Type Size Used Priority
/dev/sdb5 partition 3229024 880 -1
/swapfile file 1048568 0 -2
As you can see, now I have two swap areas.
Now turn off the old swap partition
root at jupiter:~# swapoff /dev/sdb5
root at jupiter:~# swapon -s
Filename Type Size Used Priority
/swapfile file 1048568 0 -2
root at jupiter:~# free
total used free shared buffers cached
Mem: 1997928 1967508 30420 0 8936 1365880
-/+ buffers/cache: 592692 1405236
Swap: 1048568 0 1048568
Make sure that you remove this partition out of the /etc/fstab.
Now you no longer use that swap partition. Now I can delete that disk,
if I wanted
If you have enough RAM, you can use the system w/o a swap space. As
you might have noticed, I am hardly using anything on this server and
there was nothing that was swapped out.
When you have two swap partitions and have swapped out, turning one of
them off is harmless. If necessary the second swapfile will be used.
--
Hakan (m1fcj) - http://www.hititgunesi.org
More information about the kubuntu-users
mailing list