LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-27-2007, 01:01 PM   #1
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Rep: Reputation: 15
Unhappy how to (un)swap partition to create new one to use for filing


Hi I'm a newbie,

while installing linux ubuntu i used halve of my second hdd for swap , i didn't realise you use it for memory to speed up the system.
how can i unswap (sorry for the way i saying that) , reparttion it , create a partition to save my files

if my question is not clear, please have some consideration I getting to know my pc better
 
Old 04-27-2007, 01:07 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Just turn off your swap, repartition, and reformat to use whatever filesystem you want.

Code:
swapoff /dev/hdb2
fdisk /dev/hdb
mke2fs -j /dev/hdb2
mkswap /dev/hdb3
swapon /dev/hdb3
 
Old 04-27-2007, 01:08 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
This assumes that the swap is on /dev/hdb2. Run these commands as root or sudo:
Code:
swapoff /dev/hdb2
Edit /etc/fstab and remove the line that looks like this
Code:
/dev/hdb2       none            swap    sw              0       0
Reboot your machine just to make triple-damned sure that you didn't bork it. Then run:
Code:
fdisk /dev/hdb      (to create a new partition with the freed space)
mkfs.ext3 /dev/hdb2   (to create a file system on it)
gedit /etc/fstab    (to create a mount point for it)
Post back for specific questions about how to do this if it's not clear.

Added:
jlightner brings up a good point. You will have to remove the swap partition in fdisk before you can add a Linux partition. Depending on how much memory you have and whether you have another swap space, you might consider putting a 512MB swap space on it, anyway.

Last edited by Quakeboy02; 04-27-2007 at 01:17 PM.
 
Old 04-27-2007, 01:11 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Assuming this isn't your primary swap you can disable swap with the swapoff command (type "man swapoff" for details). Once you've turned the swap off you should be able to reuse the partition for other purposes - you'll have to change the partition type since swap is a type of its own.

Also don't forget to remove this swap device from /etc/fstab so it doesn't try to re-enable it on the next boot.

Hopefully you do have SOME swap - it helps increase your virtual memory pool - you don't actually swap out to disk (it does paging instead) but by having a larger virtual pool you can have more active processes because more memory can be preallocated. (The memory isn't actually in use - just "reserved" which is why virtual memory is a good thing.)
 
Old 04-27-2007, 01:41 PM   #5
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
Shouldn't he need to restart before formatting?
The kernel normally always holds the old partition table in memory.
 
Old 04-27-2007, 04:10 PM   #6
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Original Poster
Rep: Reputation: 15
thnx, i let you fellows know when i done
 
Old 04-27-2007, 04:29 PM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Quote:
Originally Posted by deadeyes
Shouldn't he need to restart before formatting?
The kernel normally always holds the old partition table in memory.
hdparm -z /dev/foo

This will re-read the partition table.
 
Old 04-28-2007, 10:53 AM   #8
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Original Poster
Rep: Reputation: 15
I open a terminal run the code in sudo and it tells me : not such files or directory

can you tell what i'm doing wrong , please.
 
Old 04-28-2007, 11:12 AM   #9
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
When you run in sudo, you don't have root's path. Try "sudo /sbin/hdparm -z /dev/foo".
 
Old 04-28-2007, 11:58 AM   #10
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Original Poster
Rep: Reputation: 15
I log in as root i put in code swapoff /dev/hdb2 and is says now: not superuser
and surely everything after i get acces denied

is someone already running my pc for me ?
 
Old 04-28-2007, 12:00 PM   #11
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
If you are logged in as root, then you are the superuser. End of story. There must be some other issue that you don't understand enough to relate to us.
 
Old 04-28-2007, 12:37 PM   #12
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Original Poster
Rep: Reputation: 15
I'll read a bit and when i sort it, i'll be back

thnx anyway !
 
Old 04-28-2007, 12:44 PM   #13
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
One thing you could do is type "id" when you are "logged into root" and give us the output.
 
Old 04-28-2007, 03:03 PM   #14
firedancer
Member
 
Registered: Apr 2007
Posts: 146

Original Poster
Rep: Reputation: 15
uid=1000(takhai) gid=100(users) groups=4(adm), 20 (dialout), 24 (cdrom), 25 (floppy), 29 (audio), 30 (dip), 44 (video), 46 (plugdev), 100 (users), 104 (scanner), 112 (netdev), 113 (lpadmin), 115 (powerdev), 117 (admin)
 
Old 04-28-2007, 03:07 PM   #15
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
uid=1000(takhai)
Sorry, but you are logged into takhai, not into root.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create swap partition after install BobNutfield Fedora 6 02-22-2006 02:24 AM
Need to create a swap partition dotancohen Linux - General 4 07-30-2005 12:39 PM
Create swap partition AFTER installing slackware? dx0r515t Slackware 4 05-21-2005 11:29 PM
Can't create swap partition tiger99 Linux - Newbie 23 03-15-2004 09:34 PM
Create swap partition? mikeshn Linux - General 6 11-28-2002 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration