3

I was trying to add a swap partition in my secondary drive, I created the partition space with fdisk and when running mkswap I was greeted with an error:

$ sudo mkswap -c /dev/sdb2
/dev/sdb2: No such file or directory

In fact the device doesn't exist:

$ ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5
$ ls /dev/sdb*
/dev/sdb  /dev/sdb1

fdisk confirms me that the partition exists:

$ sudo fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   419432447   209715200   83  Linux
/dev/sdb2       419432448   429918207     5242880   82  Linux swap / Solaris

I'm running Ubuntu 11.10, I thought that udev would manage the devices automatically, should I still use MAKEDEV, or there is a new method to handle this problem?

1 Answer 1

4

Does sudo partprobe in a terminal do anything? I believe fdisk is supposed to do it for you when you exit but maybe it didn't.

Anything in dmesg about the new partition or a reason why it hasn't added the device node?

MAKEDEV is not the answer. Even if it works temporarily, it'll be gone after a reboot if there's a deeper problem.

5
  • I just rebooted before I saw your answer and now the device is created, since I've more space in the device I will try to create a new one and test partprobe. Yes, I suspected in fact that MAKEDEV was obsoleted, that's why I posted the question. Thank you @Caesium.
    – stivlo
    Nov 26, 2011 at 15:32
  • I've created /dev/sdb3 and noticed WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. sudo partprobe took about 4 minutes to complete, after that /dev/sdb3 was available.
    – stivlo
    Nov 26, 2011 at 15:40
  • Great :) 4 minutes sounds a fairly long time, maybe a suspect disk is taking a while to respond. I'd check the SMART details if I were you :)
    – Caesium
    Nov 26, 2011 at 15:42
  • 1
    I will check, but I think it's for the floppy, which I don't have: Warning: Unable to open /dev/fd0 read-write (Read-only file system). /dev/fd0 has been opened read-only. - Unfortunately seems there is something wrong with the BIOS which messes up the settings every time I start the PC.
    – stivlo
    Nov 26, 2011 at 15:45
  • The SMART short test said completed without error, I am now running a long test, with ETA 4h. Will see.. thanks.
    – stivlo
    Nov 26, 2011 at 16:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .