# Corresponding UNIX drives to Linux ones



## penguinhead (May 23, 2009)

I have some partitions on Kubuntu Hardy that I am freeing in order to make way for FreeBSD 7.2. I have:

/dev/sda5
/dev/sda8
/dev/sda9

as the ones which I will destroy and use their free space.

Moreover, I want to use /dev/sda10 as a second SWAP. It can't be merged onto any other partition. How do I find which adX corresponds to my desired sdaX?

Moreover, does AD represent a partition or an HD?


----------



## SirDice (May 23, 2009)

penguinhead said:
			
		

> Moreover, does AD represent a partition or an HD?


It represents a HD.

primary IDE channel, master; ad0
primary IDE channel, slave; ad1
secondary IDE channel, master; ad2
secondary IDE channel, slave; ad3
SATA disks are usually ad4 and further.

Slices aka BIOS/PC partitions are noted as s1, s2 etc. on the respective drives. So ad0s1 is the first slice on primary master.

Installing fbsd on an extended BIOS partition is a little tricky. You may want to read this thread:
http://forums.freebsd.org/showthread.php?t=3194


----------



## graudeejs (May 23, 2009)

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-naming.html


----------



## penguinhead (May 23, 2009)

The point is, FreeBSD uses a totally different language of partitioning and it thinks all HD is for him. But I can not manage to backup my data outside the PC and for that, I can only destroy the partitions I want to. I was reading the handbook, which says you may use Partition Magic or so, that means, an external partitioning utility. But the FDISK in BSD is showing unused space when there isn;t any. See my fdisk output in Kubuntu:


```
ivan@bsd:~$ sudo fdisk -l

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xfc07fc07

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1275    10241406    c  W95 FAT32 (LBA)
/dev/sda2            1276        4865    28836675    f  W95 Ext'd (LBA)
/dev/sda5            2070        2550     3863601    c  W95 FAT32 (LBA)
/dev/sda6            2551        3825    10241406    c  W95 FAT32 (LBA)
/dev/sda7            3826        4864     8345736    b  W95 FAT32
/dev/sda8            1276        2022     6000214+  83  Linux
/dev/sda9            2023        2069      377496   82  Linux swap / Solaris
/dev/sda10           4865        4865        8001   82  Linux swap / Solaris

Partition table entries are not in disk order
ivan@bsd:~$
```

And compare it with that in FreeBSD's partitioning step (attached in the pic). I shall use CRUX Linux live CD to partition HD but what do I do in BSD installation? Is it necessary to destroy all disk and surrender to BSD's imperialism?


----------



## Beastie (May 23, 2009)

penguinhead said:
			
		

> The point is, FreeBSD uses a totally different language of partitioning


This "language" eventually means exactly the same in every operating system, since in the end, all we're talking about are cylinders, heads, sectors, BIOS partitions, LBA, *bytes, etc.
I don't see any unusual "FreeBSD jargon" in fdisk.
Other OS like Windows just hide most of the stuff from the user.




			
				penguinhead said:
			
		

> and it thinks all HD is for him.


No, FreeBSD can dual-boot fine with Windows, for instance. Unless of course, you "Use Entire Disk" during the setup.




			
				penguinhead said:
			
		

> But the FDISK in BSD is showing unused space when there isn;t any. See my fdisk output in Kubuntu:


How do you know there is NOT? What if Kubuntu is wrong? Or what if it simply hides unused space because, well, it's unusable?
BIOS partitions must start and end at cylinder boundaries. So there's usually a few unused sectors left.
BTW, this unused space is only ~4.5MB in your case.




			
				penguinhead said:
			
		

> Is it necessary to destroy all disk and surrender to BSD's imperialism?


FreeBSD usually only needs 1 free BIOS partition (BSD slice), and you have 4 of these for every MBR. Just free one of these and use it for FreeBSD.
You can also do as suggested in the link SirDice provided, but I have never tested this.


----------



## penguinhead (May 24, 2009)

I've never used cylinders as my partitioning standard. I use Megabytes (should be mebibytes). How do you know only 4.5 MiBs unused? If I free up the partitions I mentioned, would I see their space listed? What do I create in that space? A partition or a slice? (The partitions are already logical partitions if you can see in fdisk output). Only sda1 is primary.

Because SWAP is a slice on the same partition as the root, will I be able to make a second SWAP in another partition? (8 MB, do not want to waste.)


----------



## Beastie (May 24, 2009)

penguinhead said:
			
		

> I've never used cylinders as my partitioning standard.


By default FreeBSD's fdisk displays the information in sectors (ST). By pressing Z (toggle size units), you can switch to MBs or GBs. In the end It.Is.All.The.Same!




			
				penguinhead said:
			
		

> How do you know only 4.5 MiBs unused?


Because fdisk says so. 9135 (am I seeing right?) sectors, with 512 bytes/sector = 4,677,120, divided by 1,048,576 (1024*1024) = 4.46




			
				penguinhead said:
			
		

> If I free up the partitions I mentioned, would I see their space listed? What do I create in that space? A partition or a slice? (The partitions are already logical partitions if you can see in fdisk output). Only sda1 is primary.
> 
> Because SWAP is a slice on the same partition as the root, will I be able to make a second SWAP in another partition? (8 MB, do not want to waste.)


An extended partition is like a container of multiple logical partitions.
When you first created the EP, you told the fdisk tool to take the remaining disk space for it. So even if you delete some LPs, the space will most probably NOT be listed in the FreeBSD setup, since the space is still used by the EP itself. Unless you can resize the EP (shrink it) with a third-party tool like Partition Magic. I'm not sure this can be done or if it's safe, especially that you said you can't backup your data.

If you really insist on installing FreeBSD on the EP, follow the link SirDice gave you. But do so at your own risk. I can't tell you more, since I've never done this (and never will) and I don't use Linux so I don't know how it behaves nor what partitioning scheme it needs.


As I already mentioned, the MBR can contain up to 4 primary BIOS partitions. And all in all, FreeBSD only needs 1 for everything (/, swap, /tmp, /var and /usr).
So you could delete the entire EP (and lose everything on it!), create 2 new partitions for Linux and FreeBSD, reinstall Linux and install FreeBSD.

That's what I would do (and would've done from the start without messing with FAT EPs), but this is your partitioning scheme and your computer.


BTW, why do you need 2 partitions for Linux swap and 4 partitions for Windows?


----------



## penguinhead (May 24, 2009)

I almost understood. I need one PRIMARY partition for FreeBSD anyway and all slices within are LOGICAL in my language, right? If I free space using CRUX Linux live CD, by deleting some partitions on the second PRIMARY partition which is extended, would I be able to use the freed space on the extended partition to carve out a totally new PRIMARY partition for FreeBSD? Or would I be deleting all stuff on the second PRIMARY partition (which is extended)?

Now I also understand the FDISK view in FreeBSD installer, that it shows only PRIMARY partitions, and not LOGICAL ones.


----------



## Beastie (May 24, 2009)

penguinhead said:
			
		

> I need one PRIMARY partition for FreeBSD


That's the default, normal and best choice, yes.




			
				penguinhead said:
			
		

> and all slices within are LOGICAL in my language


No, not exactly.
FreeBSD slice == "PRIMARY partition" you're talking about in my first quote == BIOS partition, i.e. 1 of the 4 partitions you have in an MBR (sector 0).
A FreeBSD slice is _more or less_ like an extended partition since it can contain more than 1 partition (e.g. /, swap, /usr). And FreeBSD partitions are _more or less_ like logical partitions since they are part of the all-encompassing slice.




			
				penguinhead said:
			
		

> would I be able to use the freed space on the extended partition to carve out a totally new PRIMARY partition for FreeBSD?


If you are also able to shrink the extended partition to make room for the new partition, then yes. For example, you'd resize it from ~27GB to, say 20GB, so you'd have 7GB for the entire FreeBSD slice.




			
				penguinhead said:
			
		

> Or would I be deleting all stuff on the second PRIMARY partition (which is extended)?


You'll be deleting everything stored on these particular logical partitions, and on these only, of course. But it goes without saying that if you delete a Linux system partition, the entire Linux will stop functioning properly, or at all, just as if you were deleting /usr from a FreeBSD system.




			
				penguinhead said:
			
		

> Now I also understand the FDISK view in FreeBSD installer, that it shows only PRIMARY partitions, and not LOGICAL ones.


Yes, exactly. FreeBSD's fdisk couldn't care less about logical partitions since it can only be installed (by default) on a BIOS partition.


----------



## phoenix (May 24, 2009)

penguinhead said:
			
		

> I have some partitions on Kubuntu Hardy that I am freeing in order to make way for FreeBSD 7.2. I have:
> 
> /dev/sda5
> /dev/sda8
> /dev/sda9



These are SCSI disks (sd driver in Linux).  IDE disks would use *hd* instead of sd.

In FreeBSD, these will show up as *da0s5* through *da0s9*.

(Unless this is a really recent Linux where they've decided that all harddrives should be accessed via the SCSI system, and everything shows up as sd.  Then they'll show in FreeBSD as *ad0s5* instead.)



> as the ones which I will destroy and use their free space.



These are Extended/Logical partitions.  Unless you plan on destroying *all* of your logical partitions (everything with a number higher than 5) in order to create a new primary partition for FreeBSD to use, there's no point in using these.

A PC can only have 4 partitions in the standard partition table.  You can have either 4 primary partitions, or 3 primary partitions and 1 extended partition.

You need to free up space in the partition table for another primary partition before you can install FreeBSD.


----------



## penguinhead (May 25, 2009)

Hey, I have an idea. I am going to muck up the Windows PRIMARY partition. Create a new PRIMARY out of it, for BSD!!

Linux should remain as is. /dev/sda1 shall meet its fate. Thanks to you all for the cooperation. What filesystem shall I use on BSD? (I want a journalled and fast FS, like I am using ext3 on Linux). Also tell me what does LBA read as.

remember... 
SLICE > PARTITION > FreeBSD
PRIMARY > LOGICAL > Linux
No SPECIFIC NAME > NO SPECIFIC NAME > Windows

(just for my understanding).


----------



## phoenix (May 25, 2009)

penguinhead said:
			
		

> What filesystem shall I use on BSD?



FreeBSD supports two "native" filesystems:  UFS and ZFS.  UFS is the original, tried and true, is stable, and works really well on single-drive setups.  It's not journalled, but it supports SoftUpdates which gives you almost the same protection.  ZFS has only recently (FreeBSD 7.1) added support for ZFS, and it works best on 64-bit systems with lots of RAM and lots of disks.



> Also tell me what does LBA read as.



LBA is LBA is LBA.  It's a hardware-level addressing scheme that all OSes support.



> remember...
> SLICE > PARTITION > FreeBSD



Disks are sliced up into slices.  Slices are partitioned into partitions.


----------



## Beastie (May 25, 2009)

penguinhead said:
			
		

> Also tell me what does LBA read as.


LBA or Logical Block Addressing is a way of reading/writing blocks (sectors) in an absolute way - i.e. from 0 (the MBR) to the last block in the drive - instead of using the outdated and unpractical C/H/S (cylinder/head/sector) method.
In summary, when using LBA, the OS just reads/writes a block and simply increments a pointer to read/write further blocks. When using C/H/S, it constantly has to switch between the different heads and increment sectors until it reaches the end of the current cylinder, then it switches to another cylinder and starts again the whole process of head/sector "hopping".

N.B. Of course, this LBA-C/H/S conversion is on a software-level. The conversion on a hardware-level is automatically done internally by the controller.




			
				penguinhead said:
			
		

> No SPECIFIC NAME > NO SPECIFIC NAME > Windows


Windows also uses the primary vs. extended+logical terminology during the setup and in the "Disk Management" console (diskmgmt.msc) in NT-family Windows, or with the MS-DOS fdisk during the setup in older 9x-family Windows.
But in the end, both primaries and logicals will be displayed as c:\, d:\, e:\, etc... in Explorer.


----------

