# Creating a Device file /dev/ad4s5



## quakerdoomer (Apr 14, 2009)

I don't find the MAKEDEV or any similar script/binary on FreeBSD 8.0 CURRENT 200902 Release. I need help with creating a device file /dev/ad4s5 (which unlike ad2,ad3,..etc.. strangely doesn't exist by default) for my Windows NTFS D DRIVE.


----------



## adamk (Apr 14, 2009)

You don't create devices in FreeBSD these days.  The device filesystem will  create devices when detected.  If /dev/ad4s5 doesn't exist, then the kernel doesn't see that slice.  Are you sure that's the correct device name for your D drive?

Adam


----------



## quakerdoomer (Apr 14, 2009)

Yes even I was guessing that it should autocreate it. But the same slice gets detected by DesktopBSD as ad4s5. Any idea how to force FreeBSD to map it ?
Will replacing any disk related config file from DesktopBSD help here ?


----------



## f-andrey (Apr 14, 2009)

Show

```
> fdisk -t
```
or

```
> gpart show
```


----------



## quakerdoomer (Apr 14, 2009)

From Windows my Disk View is :
78.2 MB C:
45.8 MB D:
55.8 GB E:

== gpartshowout ==

```
=>       63  234441585  ad4  MBR  (112G)
         63     160587    1  !6  (78M)
     160650   20964825    2  freebsd  [active]  (10G)
   21125475       7837       - free -  (3.8M)
   21133312  117188608    3  !7  (56G)
  138321920   96114625    4  !15  (46G)
  234436545       5103       - free -  (2.5M)

=>       0  20964825  ad4s2  BSD  (10G)
         0  18866176      1  freebsd-ufs  (9.0G)
  18866176   2098649      2  freebsd-swap  (1.0G)

=>       0  96114625  ad4s4  BSD  (46G)
         0    524288      1  freebsd-ufs  (256M)
    524288   1048576      2  freebsd-swap  (512M)
   1572864   1048576      4  freebsd-ufs  (512M)
   2621440  10565655      5  freebsd-ufs  (5.0G)
  13187095  82927530         - free -  (40G)

=>     32  1001440  da0  MBR  (489M)
       32       31       - free -  (16K)
       63  1001409    1  !12  [active]  (489M)
```


== END OF gpartshowout ==
gpart show thinks there is 40 GB  Free space in ad4s4.. weird !
Also says   138321920   96114625    4  !15  (46G)

Here is the "fdisk -t" output
== fdisk-tout ==

```
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=232581 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=232581 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary DOS, 16 bit FAT (>= 32MB))
    start 63, size 160587 (78 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 9/ head 254/ sector 63
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 160650, size 20964825 (10236 Meg), flag 80 (active)
	beg: cyl 10/ head 0/ sector 1;
	end: cyl 1023/ head 254/ sector 63
The data for partition 3 is:
sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
    start 21133312, size 117188608 (57221 Meg), flag 0
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 36/ sector 2
The data for partition 4 is:
sysid 15 (0x0f),(Extended DOS (LBA))
    start 138321920, size 96114625 (46930 Meg), flag 0
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 254/ sector 63
```
== END of fdisk-tout ==


----------



## graudeejs (Apr 14, 2009)

/dev/ad4s5
is not possible, because x86 is limited to 4 slices.

But if you are using gpt partitions then you can have up to 128 (or 127, don't remember) of them.

perhaps it was /dev/ad4p5
?


----------



## adamk (Apr 14, 2009)

> /dev/ad4s5
> is not possible, because x86 is limited to 4 partitions.



You can certainly have slices beyond s4:


```
[ adamk@sorrow - /dev ]: ls -1 /dev/ad6s*
/dev/ad6s1
/dev/ad6s2
/dev/ad6s2a
/dev/ad6s2b
/dev/ad6s2c
/dev/ad6s2d
/dev/ad6s2e
/dev/ad6s2f
/dev/ad6s2g
/dev/ad6s5
/dev/ad6s6
/dev/ad6s7
/dev/ad6s8
```

Logical partitions will show up as s5 and higher.

Adam


----------



## graudeejs (Apr 14, 2009)

yes, logical will


----------



## Djn (Apr 14, 2009)

killasmurf86 said:
			
		

> yes, logical will


He's got an extended partition there, so it's probably inside that.

Logical partitions have been slightly iffy for me lately - not that that's specific enough to help ...


----------



## quakerdoomer (Apr 15, 2009)

```
DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     F   FreeBSD_Ins  CDFS   DVD-ROM      927 MB
  Volume 1     C                FAT    Partition     78 MB  Healthy    System
  Volume 2     E                NTFS   Partition     56 GB  Healthy    Boot
  Volume 3     D   OverHead     NTFS   Partition     46 GB  Healthy

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             78 MB    32 KB
  Partition 2    Unknown             10 GB    78 MB
  Partition 3    Primary             56 GB    10 GB
  Partition 4    Extended            46 GB    66 GB
  Partition 5    Logical             46 GB    66 GB
```

D Drive is Extended Logical indeed. Can we declare this as a yet to be resolved FreeBSD 8.0 CURRENT bug ?


----------



## f-andrey (Apr 15, 2009)

killasmurf86 said:
			
		

> perhaps it was /dev/ad4p5?




```
# mount_ntfs /dev/ad4p4 /mnt
```
not work?

show

```
> ls /dev/ | grep ad
```


----------



## quakerdoomer (Apr 16, 2009)

```
ad4
ad4s1
ad4s2
ad4s2a
ad4s2b
ad4s3
ad4s4
ad4s4a
ad4s4b
ad4s4d
ad4s4e
```


----------



## SirDice (Apr 16, 2009)

killasmurf86 said:
			
		

> /dev/ad4s5
> is not possible, because x86 is limited to 4 partitions.


4 Primary DOS partitions (aka bsd slices), yes. s5 is inside an Extended DOS Partition.



> But if you are using gpt partitions then you can have up to 128 (or 127, don't remember) of them.


You are confusing slices and partitions.


----------



## f-andrey (Apr 16, 2009)

quakerdoomer said:
			
		

> From Windows my Disk View is :
> 78.2 MB C:
> 45.8 MB D:
> 55.8 GB E:



If we look gpart show


```
78.2 MB C: = ad4s1
55.8 GB E: = ad4s3
```
ad4s2a-b and ad4s4a-e free bsd partitions.

You may be install FreeBSD on disk D: and format his "ad4s4  BSD  (46G)" = "Volume 3     D   OverHead     NTFS   Partition     46 GB  Healthy" :q


----------



## quakerdoomer (Apr 17, 2009)

Yes OverHead is D: 46 GB
But according to gpart the scene is :
ad4s4  BSD  (46G)
gpart on BSD seems to misread it and shows  - free -  (40G) which is what actually FreeBSD 8.0 CUrrent thinks is true. I want to mount the D Drive :-(


----------



## Djn (Apr 17, 2009)

quakerdoomer said:
			
		

> Yes OverHead is D: 46 GB
> But according to gpart the scene is :
> ad4s4  BSD  (46G)
> gpart on BSD seems to misread it and shows  - free -  (40G) which is what actually FreeBSD 8.0 CUrrent thinks is true. I want to mount the D Drive :-(



Mh, I ran into this as well when fiddling with installing to a logical partition.
Try kldloading geom_part_mbr and see what happens?


----------



## quakerdoomer (Apr 17, 2009)

kldload ./??????? 
I'm afraid I didn't get that one.


----------



## Djn (Apr 17, 2009)

Unless I'm not mistaken: 
	
	



```
kldload geom_part_mbr
```

Not entirely sure what will happen - it should in theory already be active, but loading it made more partitions show up for me.


----------



## quakerdoomer (Apr 18, 2009)

```
DIGITAL-TRAITOR# kldload geom_part_mbr
kldload: can't load geom_part_mbr: File exists
```

Some more interesting lines from dmesg output :


```
GEOM: ad4: partition 4 does not start on a track boundary.               
GEOM: ad4: partition 4 does not end on a track boundary.                 
GEOM: ad4: partition 3 does not start on a track boundary.               
GEOM: ad4: partition 3 does not end on a track boundary.                 
GEOM_LABEL: Label for provider ad4s1 is msdosfs/DellUtility.             
GEOM: ad4s2: geometry does not match label (255h,63s != 16h,63s).        
GEOM: ad4s4: media size does not match label.
```


----------



## graudeejs (Apr 18, 2009)

SirDice said:
			
		

> You are confusing slices and partitions.



ye, your right my mistake


ad1 - disk 1
ad1[red]*s*[/red]2 - [red]*s*[/red]lice 2 on disk 1
ad1[red]*s*[/red]2d - label d on [red]*s*[/red]lice 2 on disk 1

ad2 - disk 2
ad2[red]*p*[/red]1 - disk 2, GUID [red]*p*[/red]artition 1


----------



## quakerdoomer (Sep 29, 2009)

A small update to those involved in this thread :

ad4s1 is C:
ad4s3 is E:
On DesktopBSD and PCBSD I see D: as ad0s5

I remember replacing 8.0-CURRENT June release with an old untarred Feb Archive. This gave me access to ad4s5 (or was it ad4s4 ?? )

I am now using RC1 but I still unlucky with D:
The fdisk output is the same as mentionbed above in April
I don't know what's goin on.

I see ad4s4 and devices from ad4s4a to ad4s4e
uname output :

```
FreeBSD DIGITAl-TRAITOR 8.0-RC1 FreeBSD  8.0-RC1
```

Will deleting the partition and converting it to FAT32 help me ?


----------



## aragon (Sep 29, 2009)

On your RC1 system, paste the output of:


```
fdisk /dev/ad4
```

and


```
ls /dev/ad4*
```


----------



## quakerdoomer (Sep 30, 2009)

```
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=232581 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=232581 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary DOS, 16 bit FAT (>= 32MB))
    start 63, size 160587 (78 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 9/ head 254/ sector 63
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 160650, size 20964825 (10236 Meg), flag 80 (active)
	beg: cyl 10/ head 0/ sector 1;
	end: cyl 1023/ head 254/ sector 63
The data for partition 3 is:
sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
    start 21133312, size 117188608 (57221 Meg), flag 0
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 36/ sector 2
The data for partition 4 is:
sysid 15 (0x0f),(Extended DOS (LBA))
    start 138321920, size 96114625 (46930 Meg), flag 0
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 254/ sector 63
```




```
/dev/ad4
/dev/ad4s1
/dev/ad4s2
/dev/ad4s2a
/dev/ad4s2b
/dev/ad4s3
/dev/ad4s4
/dev/ad4s4a
/dev/ad4s4b
/dev/ad4s4d
/dev/ad4s4e
```


----------



## aragon (Sep 30, 2009)

And fdisk /dev/ad4s4 ?


----------



## quakerdoomer (Sep 30, 2009)

```
DIGITAL-TRAITOR# fdisk /dev/ad4s4
******* Working on device /dev/ad4s4 *******
parameters extracted from in-core disklabel are:
cylinders=95351 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=95351 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
    start 63, size 96114562 (46930 Meg), flag 0
        beg: cyl 1023/ head 37/ sector 3;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
DIGITAL-TRAITOR#
```

..which I think is very weird. Windows sees D drive as 45.8 GB


----------



## aragon (Oct 1, 2009)

What's strange for me is that ad4s4 is an extended partition with a NTFS logical partition in it, yet FreeBSD seems to think it's a UFS partition.  You shouldn't have ad4s4a, b, etc. - should be just ad4s4 and ad4s5.

Out of interest, what does "bsdlabel ad4s4" say?

You might want to post to one of the mailing lists and/or file a PR about this...


----------



## quakerdoomer (Oct 1, 2009)

```
DIGITAL-TRAITOR# bsdlabel ad4s4
# /dev/ad4s4:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:   524288        0    4.2BSD     2048 16384 32776
  b:  1048576   524288      swap
  c: 13187095        0    unused        0     0         # "raw" part, don't edit
  d:  1048576  1572864    4.2BSD     2048 16384     8
  e: 10565655  2621440    4.2BSD     2048 16384 28552
bsdlabel: partition c doesn't cover the whole unit!
bsdlabel: An incorrect partition c may cause problems for standard system utilities
DIGITAL-TRAITOR#
```


----------



## aragon (Oct 1, 2009)

At some point in time, was that 4th partition a BSD partition before you made it an extended logical NTFS partition?


----------



## quakerdoomer (Oct 1, 2009)

According to Windows XP Logical Disk Manager Service the 4th Partition is not an Extended one.
I have 4 partition and all are Primary ones.
C: (78MB)
UFS (10GB) Unknown as per Windows
E: 55.88 GB
D: 45.83 GB

I don't have any extended ones and the 4th one was never a BSD partition, it was just Free space.


----------



## quakerdoomer (Oct 6, 2009)

I solved it. I deleted the D DRIVE PARTITION completely. Now I again had free space. I Recreated the same partition with same amount of size and now I do see /dev/ad4s5. 

I don't know how many have faced tis but ntfs-3g (fusefs) if used to mount a NTFS Drive has to be safely unmounted else your files disappear and you need to run chkdsk X: /F

THANKS to everyone involved in this thread.


----------

