View previous topic :: View next topic |
Author |
Message |
Ryuzaki Tux's lil' helper
Joined: 29 Aug 2010 Posts: 96 Location: N/A
|
Posted: Thu Sep 16, 2010 12:21 am Post subject: mkswap and swapon issues |
|
|
I'm trying to activate my swap partition, and last time I built a Gentoo system (which was on the same hard-drive) it worked just fine. But now, I'm being told when I type in
# mkswap /dev/sda2
/dev/sda2: Device or resource busy
Same kind of situation with this:
# swapon /dev/sda2
swapon: /dev/sda2: swapon failed: Device or resource busy
What does this mean and how can I fix it?? |
|
Back to top |
|
|
psycho Guru
Joined: 22 Jun 2007 Posts: 534 Location: New Zealand
|
Posted: Thu Sep 16, 2010 12:32 am Post subject: |
|
|
are you sure haven't mounted /dev/sda2 somewhere? type Code: | mount | grep /dev/sda2 | and if it shows up, unmount it. |
|
Back to top |
|
|
Ryuzaki Tux's lil' helper
Joined: 29 Aug 2010 Posts: 96 Location: N/A
|
Posted: Thu Sep 16, 2010 1:01 am Post subject: |
|
|
psycho wrote: | are you sure haven't mounted /dev/sda2 somewhere? type Code: | mount | grep /dev/sda2 | and if it shows up, unmount it. |
Yeah... it was mounted. I went into GParted, and redid it all real quick, and found out that things have to be unmounted for those kind of things. lol
Thanks for the help. We n00bs love you. <3 =D |
|
Back to top |
|
|
Jerichoo n00b
Joined: 02 Apr 2008 Posts: 63 Location: Turkey
|
Posted: Sat Apr 28, 2012 10:34 am Post subject: |
|
|
i have the same issue also and i am sure that /dev/sda2 unmounted here is my output
Quote: |
root@ubuntu:~# mount | grep /dev/sda2
root@ubuntu:~# mkswap /dev/sda2
/dev/sda2: Device or resource busy
root@ubuntu:~#
|
by the way i am installing the gentoo via xubuntu i hope its not about that |
|
Back to top |
|
|
ultraincognito Guru
Joined: 03 Jun 2011 Posts: 346 Location: Ukraine
|
Posted: Sat Apr 28, 2012 11:49 am Post subject: |
|
|
Jerichoo, your sda2 is mounted with the other device name. |
|
Back to top |
|
|
disperato Tux's lil' helper
Joined: 27 Apr 2004 Posts: 120
|
Posted: Sat Apr 28, 2012 5:05 pm Post subject: |
|
|
Jerichoo wrote: | i have the same issue also and i am sure that /dev/sda2 unmounted here is my output
root@ubuntu:~# mount | grep /dev/sda2
root@ubuntu:~# mkswap /dev/sda2
/dev/sda2: Device or resource busy
root@ubuntu:~#
|
please, post the output of
I suspect that your sda2 is the extended partition on to there are logical sda5, sda6... which is a legal configuration alternative to:
sda1, sda2 (up to sda4) primary partitions
OR
sda1, sda2 (up to sda3) primary and sda4 extended
AFAIK you can have 4 primary partitions max, or up to three primary partitions and one extended.
Tipical, but not mandatory configs are:
Code: | for system only based on linux:
sda1:boot, sda2:root, sda3:extended;
sda4:name_reserved;
from sda5 on, logical partitions onto the extended one.
|
Code: | for system in dual boot with windows:
sda1:windows, sda2:extended;
sda3:name_reserved, sda4:name_reserved;
from sda5 on, logical partitions onto the extended one.
|
as an example, here is my fdisk -l /dev/sda:
Code: | Device Boot Start End Blocks Id System
/dev/sda1 * 63 530144 265041 83 Linux
/dev/sda2 530145 56950424 28210140 83 Linux
/dev/sda3 56950425 625137344 284093460 5 Extended
/dev/sda5 56950488 61175519 2112516 83 Linux
/dev/sda6 61175583 254132234 96478326 83 Linux
/dev/sda7 254132298 275129189 10498446 83 Linux
/dev/sda8 275129253 275643269 257008+ 82 Linux swap / Solaris
/dev/sda9 275643333 288061514 6209091 83 Linux
/dev/sda10 288061578 290101769 1020096 83 Linux
/dev/sda11 290101833 625137344 167517756 83 Linux |
_________________ The free men's path is always obstructed by mediocrity. |
|
Back to top |
|
|
Jerichoo n00b
Joined: 02 Apr 2008 Posts: 63 Location: Turkey
|
Posted: Sat Apr 28, 2012 7:09 pm Post subject: |
|
|
Quote: |
root@ubuntu:~# fdisk -l /dev/sda
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x10a7481e
Device Boot Start End Blocks Id System
/dev/sda1 2048 67583 32768 83 Linux
/dev/sda2 67584 1116159 524288 82 Linux swap / Solaris
/dev/sda3 1116160 85002239 41943040 83 Linux
/dev/sda4 * 85002240 625139711 270068736 7 HPFS/NTFS/exFAT
root@ubuntu:~#
|
here is the output you want but i must say that i was using this configuration recently.actually i dont know the difference between extented and primary or which one to use on where |
|
Back to top |
|
|
disperato Tux's lil' helper
Joined: 27 Apr 2004 Posts: 120
|
Posted: Sat Apr 28, 2012 9:21 pm Post subject: |
|
|
ok Jerichoo, your partitioning is a bit unusual but looks correct for a dual boot. On my system I've the same "error" if I try to mkswap or swapon, because obviously linux is using swap and it is already initialised (or formatted, if you prefer, but linux, as I guess uses raw data for swap), and activated (swapon). Like your case, though, If I type mount, it isn't listed there:
mount |grep sda8 --> nothing
mount |grep swap --> nothing
but...
Code: | # free
total used free shared buffers cached
Mem: 7924400 1130996 6793404 0 1220 569520
-/+ buffers/cache: 560256 7364144
Swap: 257004 0 257004 |
As expected, given that swap should mount at boot:
Code: | # grep swap /etc/fstab
/dev/sda8 none swap sw 0 0 |
Maybe you are trying to activate swap from a boot cd that automatically recognises swap partitions on hd if previously activated by you for a running or installed (or partially installed) system (autodiscovery).
Either if you booted from hd or boot-cd, exploring the /etc/fstab might help:
Code: | grep swap /etc/fstab |
and to have a more general picture
I may look too supposing, but think you are trying to "format" and initialise a swap partition already formatted and initialised, maybe already in use (look at the size of swap from free command).
Hope this helps. _________________ The free men's path is always obstructed by mediocrity. |
|
Back to top |
|
|
BillWho Veteran
Joined: 03 Mar 2012 Posts: 1600 Location: US
|
Posted: Sat Apr 28, 2012 11:57 pm Post subject: |
|
|
Ryuzaki,
For future reference, swap does not show with the mount command. To check if swap is active and where
If you need to to disable it
Good luck _________________ Good luck
Since installing gentoo, my life has become one long emerge |
|
Back to top |
|
|
Jerichoo n00b
Joined: 02 Apr 2008 Posts: 63 Location: Turkey
|
Posted: Sun Apr 29, 2012 2:06 am Post subject: |
|
|
i should have used the knoppix as i always do.i hate ubuntu
i am gonna try with knoppix
+
i dont think my drive map is strange i have done as gentoohanbook says
Quote: |
Creating the Boot Partition
We first create a small boot partition. Type n to create a new partition, then p to select a primary partition, followed by 1 to select the first primary partition. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, type +32M to create a partition 32 Mbyte in size and set its bootable flag:
Code Listing 3.6: Creating the boot partition
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3876, default 1): (Hit Enter)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +32M
Now, when you type p, you should see the following partition printout:
Code Listing 3.7: Created boot partition
Command (m for help): p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 14 105808+ 83 Linux
We need to make this partition bootable. Type a to toggle the bootable flag on a partition and select 1. If you press p again, you will notice that an * is placed in the "Boot" column.
Creating the Swap Partition
Let's now create the swap partition. To do this, type n to create a new partition, then p to tell fdisk that you want a primary partition. Then type 2 to create the second primary partition, /dev/sda2 in our case. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, type +512M to create a partition 512MB in size. After you've done this, type t to set the partition type, 2 to select the partition you just created and then type in 82 to set the partition type to "Linux Swap". After completing these steps, typing p should display a partition table that looks similar to this:
Code Listing 3.8: Partition listing after creating a swap partition
Command (m for help): p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 14 105808+ 83 Linux
/dev/sda2 15 81 506520 82 Linux swap
Creating the Root Partition
Finally, let's create the root partition. To do this, type n to create a new partition, then p to tell fdisk that you want a primary partition. Then type 3 to create the third primary partition, /dev/sda3 in our case. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, hit enter to create a partition that takes up the rest of the remaining space on your disk. After completing these steps, typing p should display a partition table that looks similar to this:
Code Listing 3.9: Partition listing after creating the root partition
Command (m for help): p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 14 105808+ 83 Linux
/dev/sda2 15 81 506520 82 Linux swap
/dev/sda3 82 3876 28690200 83 Linux
|
i just add that a partition (primary) for windows 7 which has to be primary i believe |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|