1

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!~

2 Answers 2

4

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
3

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
2
  • 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, 2011 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. May 4, 2011 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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