Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new about swap and filesystem. Now I encounter a problem:

2G ext4 disk /dev/sda7 # Want to be used as swap in fedora

24G ext4 disk /dev/sda8 # My fedora is built on it without Swap

As described above, I want to use /dev/sda7 as swap in /dev/sda8. How to deal with it? Thank you!~

share|improve this question

2 Answers 2

up vote 4 down vote accepted

First - make sure there is nothing in /dev/sda7 you want to keep - this will wipe all data in it. /dev/sda7 should not be mounted.

Then run (as root):

# mkswap /dev/sda7
# swapon /dev/sda7

Then edit /etc/fstab and add a line:

/dev/sda7   none    swap    sw    0     0
share|improve this answer

It's better to use the UUID in the fstab file.

Type in a terminal:

blkid

and find the UUID-String. Copy this in the fstab, like so:

UUID=bdc82ac5-5605-44d1-b3d0-6b69a47accd7 swap         swap    defaults        0 0
share|improve this answer
    
I'm interested to know if this is the case for swap partitions. I use UUIDs for everything but I'm not sure it's important for the swap partition. Can anyone enlighten me? –  boehj May 3 '11 at 12:06
    
@boehj The naming of devices (such as /dev/hda5) can change, for example, mobile devices or hard drive cables are reconnected in the computer. To get around this, can the UUID or the label of the device (the hard drive name, eg data) can be specified. Hope you undertand my bad english. –  Pit Schnass May 4 '11 at 6:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.