# Partitioning an external hard drive WD MyBook



## Ico (Feb 26, 2009)

Hey guys,

I just got a 1TB external hard drive (USB) by Western Digital.
Hooked it up to my FreeBSD server and mounted it - no problems. Even mapped it to a windows laptop using Samba.

My question is, what is the easiest way to partition the disk into say a 400GB and a 600GB slices. I am used to cfdisk from my Linux days, I really have no experience with fdisk, so exact commands would be helpful too. I was reading the handbook and it mentions a ton of stuff that needs done.. dd, bsdlabel, fdisk, etc. All I want to do is slice the disk into two MSDOSFS disks 1 for backups and 1 for storage so I can map them to the Winblows laptops.

Any help is greatly appreciated.


----------



## plamaiziere (Feb 26, 2009)

Ico said:
			
		

> Hey guys,
> My question is, what is the easiest way to partition the disk into say a 400GB and a 600GB slices. I am used to cfdisk from my Linux days, I really have no experience with fdisk, so exact commands would be helpful too. I was reading the handbook and it mentions a ton of stuff that needs done.. dd, bsdlabel, fdisk, etc. All I want to do is slice the disk into two MSDOSFS disks 1 for backups and 1 for storage so I can map them to the Winblows laptops.
> 
> Any help is greatly appreciated.



You can use sysinstall to partition your disk, it is more user friendly than fdisk.


----------



## Ico (Feb 26, 2009)

The Disk Label editor?

Btw I think I have encountered a problem with samba and msdosfs and rw permissions. When I try to create a dir or a file on the share I get a nasty error about device being in use..

Looking at the smb logs, smbd is going nuts:


```
[2009/02/26 15:16:17,  0] lib/util.c:smb_panic(1663)
  PANIC (pid 25969): internal error
[2009/02/26 15:16:17,  0] lib/util.c:log_stack_trace(1767)
  BACKTRACE: 19 stack frames:
   #0 0x2799a5 <smb_panic+133> at /usr/local/sbin/smbd
   #1 0x262bfa <dump_core_setup+1242> at /usr/local/sbin/smbd
   #2 0xbfbfffb4
   #3 0x207eeb8a <abort+106> at /lib/libc.so.7
   #4 0x249c7c <telldir+124> at /usr/local/sbin/smbd
   #5 0x266b1d <sys_telldir+29> at /usr/local/sbin/smbd
   #6 0xe6ced <vfswrap_lstat+1805> at /usr/local/sbin/smbd
   #7 0x7653b <ReadDirName+219> at /usr/local/sbin/smbd
   #8 0x7789b <can_delete_directory+427> at /usr/local/sbin/smbd
   #9 0x778e8 <dptr_ReadDirName+56> at /usr/local/sbin/smbd
   #10 0xad602 <get_allocation_size+12034> at /usr/local/sbin/smbd
   #11 0xb09c3 <get_allocation_size+25283> at /usr/local/sbin/smbd
   #12 0xb0e9c <get_allocation_size+26524> at /usr/local/sbin/smbd
   #13 0xb6c07 <reply_trans2+1719> at /usr/local/sbin/smbd
   #14 0xd5af6 <remove_deferred_open_smb_message+2486> at /usr/local/sbin/smbd
   #15 0xd7505 <srv_send_smb+1109> at /usr/local/sbin/smbd
   #16 0xd827b <smbd_process+3259> at /usr/local/sbin/smbd
   #17 0x4bd51d <main+8269> at /usr/local/sbin/smbd
   #18 0x5ed99 <_start+137> at /usr/local/sbin/smbd
[2009/02/26 15:16:17,  0] lib/fault.c:dump_core(201)
  dumping core in /var/log/samba/cores/smbd
[2009/02/26 15:16:24,  1] smbd/service.c:make_connection_snum(1194)
  LAPTOPX (192.168.15.100) connect to service WD initially as user lee (uid=1001, gid=1001) (pid 26586)
[2009/02/26 15:16:24,  0] lib/fault.c:fault_report(40)
```

Is there anyone else who has an external hdd with msdosfs who is able to use it with Samba?


----------



## julz (Mar 22, 2009)

Not related to msdosfs, but I see lots of similar smb_panics with 'dumping core' on a couple of FreeBSD 6.2 machines.
I don't see this problem with 3.0 series of samba, but in 3.2 and 3.3 smbd keeps crashing which of course makes the connection unreliable.


----------



## DutchDaemon (May 26, 2009)

Narrow escape ... http://www.theregister.co.uk/2009/05/26/wd_outrage/


----------



## SirDice (May 26, 2009)

Ico said:
			
		

> All I want to do is slice the disk into two MSDOSFS disks 1 for backups and 1 for storage so I can map them to the Winblows laptops.


You do not have to use msdosfs if you want to share it using samba. It can be 'regular' fbsd UFS.


----------



## Bunyan (Jun 8, 2009)

Ico said:
			
		

> Hey guys,
> ..... I am used to cfdisk from my Linux days, I really have no experience with fdisk, so exact commands would be helpful too


*cfdisk* stands for _curses fdisk_.
cfdisk is a pseudo-graphical *fdisk*. So, you want to partition your external HDD by using Linux *fdisk*.
I'll assume that your 1Tb HDD is either SCSI or SATA, i.e /dev/sdX.
On my system it would go like follows:
Code:
fdisk /dev/sdb
...........
n (to create a BIOS partition) 
#Then the clever program asks you
p - primary
l - logical
# For a FreeBSD slice you need a primary partion, so you choose *p*
p
# On a HDD one can have only 4 pimary partitions, since it is the first partition, choose 1
1
# Then you are prompted to set the size of the partition. I think you'll manage how to do that. + 400000 M, for example.
# Now you need to set the type of the partition, so that FreeBSD could recognize as *165* and *newfs* it! 
t
a5
# Is it going to house a full FreeBSD installation? If yes, you should set the bootable flag on.
a
# In case you need the slice to hold only data, skip this step.
# Now we need to write our changes to disk:
w
# After this command, *fdisk* quits.  

Boot your *FreeBSD*, see *dmesg*, run *SYSINSTALL* and initialize your new UFS2 filesystem. Then you can mount your external HDD
as */dev/daNsX*, for example */dev/da0s1* in my case.


----------



## Bunyan (Jun 8, 2009)

In my post I used the *Linux fdisk* from a live CD, like Slackware !


----------



## hedwards (Jun 10, 2009)

I'd pay attention to the disk, I know my previous WD external drive was only supported under Windows and possibly Mac. It had some sort of proprietary bit which caused it to go to go to sleep on it's own and not wake up again if I left it set for a while.

I won't personally be buying anymore WD external drives, hopefully that sort of bug isn't affecting the model you got.


----------

