3

I'm trying to edit some init scripts that have gone haywire on my raspberry pi Noobs SD card, and since it's easier, I'm trying to edit them on a MacPro 3,1 Ubuntu box I have.

After I plug the sd-card in to the MacPro, I run sudo fdisk -l and I get the following listing:

Disk /dev/sdb: 7861 MB, 7861174272 bytes
4 heads, 16 sectors/track, 239904 cylinders, total 15353856 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: 0x000ba6a2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2466796     1232374+   e  W95 FAT16 (LBA)
/dev/sdb2         2473984    15353855     6439936   85  Linux extended
/dev/sdb5         2482176     2596863       57344    c  W95 FAT32 (LBA)
/dev/sdb6         2605056    15353855     6374400   83  Linux

Disk /dev/sdb1: 3932 MB, 3932160000 bytes
4 heads, 16 sectors/track, 120000 cylinders, total 7680000 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: 0x000ba6a2

     Device Boot      Start         End      Blocks   Id  System
/dev/sdb1p1            2048     2466796     1232374+   e  W95 FAT16 (LBA)
/dev/sdb1p2         2473984    15353855     6439936   85  Linux extended
/dev/sdb1p5         2482176     2596863       57344    c  W95 FAT32 (LBA)
/dev/sdb1p6         2605056    15353855     6374400   83  Linux

But when I actually try to mount either of the Linux (I'm assuming ext4) partitions it tells me that the device does not exist.

sudo mount -t ext4 /dev/sdb2 /media/pi
mount: special device /dev/sdb2 does not exist

Is there some other way to mount my Raspberrian installation on my Ubuntu box?

  • In addition to the answer by @goldilocks, you cannot mount sdb6, because it is already mounted on /. – Milliways Feb 28 '15 at 21:58
  • @Milliways but where would it end up mounting? It wasn't in /media – leeand00 Feb 28 '15 at 22:20
  • it is mounted on / In /boot/cmdline.txt you will find something like root=/dev/mmcblk0p2 rootfstype=ext4 (this is NOT from NOOBS which will presumably be root=/dev/mmcblk0p6) – Milliways Feb 28 '15 at 23:42
3

The /dev/sdb2 extended partition reported by fdisk is one that's divided into a number of other "logical partitions". The reason for this is that MBR partition tables only actually have room for four primary partitions, so if you want more, they have to be chained in this way.

This is also why there's no sdb3 and sdb4; these are the primary partitions but you only actually have two, sdb1 and the aforementioned extended partition sdb2.

sdb5 and sdb6 are logical partitions referenced via the table associated with the first extended partition, in this case sdb2.

What that adds up to is you can ignore sdb2. The only real partitions are 1, 5, and 6. This does not necessarily mean they have been formatted, however, so you may get some error if you try to mount them.

  • I ended up using CentOS to access the extended partion, and make the changes. But why did that work on CentOS and not work on ubuntu? Must need something installed... – leeand00 Feb 28 '15 at 22:20
-1

I had a similar problem and ended up on this question. Eventually I found the actual solution here:

As it is in your output of fdisk, each Unit has 512 bytes:

Units = sectors of 1 * 512 = 512 bytes

The solution would be to mount partition sdb1 with an offset where the Linux partition (sdb6) starts:

sudo mount -t ext4 /dev/sdb1 /media/pi -o offset=$((2605056*512))

The 2605056 comes from the Start block value on your output:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2466796     1232374+   e  W95 FAT16 (LBA)
/dev/sdb2         2473984    15353855     6439936   85  Linux extended
/dev/sdb5         2482176     2596863       57344    c  W95 FAT32 (LBA)
/dev/sdb6         2605056    15353855     6374400   83  Linux

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.