[SLL] [herber at thing.com: Re: unable to mount old drive when it's secondary]

Ana christiana at hipointcoffee.com
Thu Oct 18 13:56:21 PDT 2007


On Thu, Oct 18, 2007 at 12:04:51PM -0700, Steve Herber wrote:
> My favorite command in this situation is simply - fdisk -l
> 
> As root, this will give you a list of all the partitions on all the disks 
> that your kernel can see.  Depending upon kernel version your drive may 
> show up under somewhere other than where you expect it.
> 
> Good luck!
> 
> Steve Herber	herber at thing.com		work: 206-221-7262
> Security Engineer, UW Medicine, IT Services	home: 425-454-2399
>


That did it.  :)

When I ran 'fdisk -l' I saw that sdb and another device I would never
have know to look for: "/dev/dm-0", both point to the same device.  I
was utterly shocked and confused.  haha.  In the fdisk listing below you
can see that the partition info for both sdb and dm-0 are the same
except for the device names.

I tried to mount "/dev/dm-0p1" like I would /dev/sdb1 and found that the
device file didn't exist.  So...  I thought:  hm...  maybe I can create
a device file and rtfm'd about mknod.

I was also surprised to notice that /dev/sdb and /dev/dm-0 have
different device major numbers.

root at betty:dev# ls -la dm-0 sdb
brw-rw---- 1 root disk 254,  0 2007-10-18 00:37 dm-0
brw-rw---- 1 root disk   8, 16 2007-10-18 00:37 sdb

I know roughly how device major-minor numbers work so I guessed the
minor number I might try to use to get to the first partition on the
dm-0 device would be 1, as it's 1 greater than the dm-0 minor number.
So, I created that device.

root at betty:dev# mknod dm-0p1 b 254 1

Shortly after though...  I noticed that the device "/dev/dm-1" was
already using the major:minor pair of the device file I'd just created,
which was confusing.

Then it hit me that what I had assumed was garbage at the end of the
fdisk -l output was actually fdisk's attempt to find partition tables in
each of the partitions on dm-0 (sdb).

: dm-1 is a 1003-MB "Disk" without a valid partition table
: dm-2 is a 10.0 GB "Disk" with no partition table
: dm-3 is a 107.9 GB "Disk" with no partition table 
: dm-4 is a 1028 MB  "Disk" with no partition table 

It so happens that those the the sizes of my partitions on sdb.  :)  So,
I tried to mount /dev/dm-1, and it worked.

One does learn something new every day, but some days stand out more
than others.

Thank You Steve!!!

- Ana



------------------------------------------------------------------------
root at betty:dev# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008c9bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       29164   234259798+  83  Linux
/dev/sda2           29165       30401     9936202+   5  Extended
/dev/sda5           29165       30401     9936171   82  Linux swap / Solaris

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bbd0f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         122      979933+  83  Linux
/dev/sdb2             123        1338     9767520    c  W95 FAT32 (LBA)
/dev/sdb3            1339       14468   105466725   83  Linux
/dev/sdb4           14469       14593     1004062+  82  Linux swap / Solaris

Disk /dev/dm-0: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bbd0f

     Device Boot      Start         End      Blocks   Id  System
/dev/dm-0p1   *           1         122      979933+  83  Linux
/dev/dm-0p2             123        1338     9767520    c  W95 FAT32 (LBA)
/dev/dm-0p3            1339       14468   105466725   83  Linux
/dev/dm-0p4           14469       14593     1004062+  82  Linux swap / Solaris

Disk /dev/dm-1: 1003 MB, 1003451904 bytes
255 heads, 63 sectors/track, 121 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 10.0 GB, 10001940480 bytes
255 heads, 63 sectors/track, 1216 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

     Device Boot      Start         End      Blocks   Id  System

Disk /dev/dm-3: 107.9 GB, 107997926400 bytes
255 heads, 63 sectors/track, 13130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb967e1f3

Disk /dev/dm-3 doesn't contain a valid partition table

Disk /dev/dm-4: 1028 MB, 1028160000 bytes
255 heads, 63 sectors/track, 125 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-4 doesn't contain a valid partition table
root at betty:dev# 
------------------------------------------------------------------------




More information about the linux-list mailing list