Since my workstation doesn't support FreeBSD UFS file system, I'll partition & format it using the FreeBSD server. All tools involve are command line utilities and can be done through remote secure shell. This post can also be serve as a guide for adding new/used additional hard disk to FreeBSD server.
Here goes :
Multiple hard disk slices
- Create a partition table on the external hard disk :
$ gpart create -s gpt da0 da0 created
- List the partition table :
$ gpart show da0 => 63 312579603 da0 MBR (149G) 63 312579603 - free - (149G)
- Slice the first partition with FreeBSD UFS file system :
$ gpart add -s 50G -t freebsd-ufs da0 da0p1 added
- Slice the second partition with FreeBSD UFS file system :
$ gpart add -s 50G -t freebsd-ufs da0 da0p2 added
- Slice the third partition (remaining hard disk space) with FAT32 file system :
$ gpart add -t mbr da0 da0p3 added
- Format the partitions :
$ newfs /dev/da0p1a
$ newfs /dev/da0p2b
$ newfs_msdos -F32 /dev/da0p3
If you're using the hard disk fully in FreeBSD environment, follow the below steps instead to create a single big slice of the hard disk :
Single(disk space utilized) slice
$ gpart create -s gpt da0 da0 created
$ gpart show da0 => 63 312579603 da0 GPT (149G) 63 312579603 - free - (149G)
$ gpart add -t freebsd da0 da0s1 added
(take note of the output "da0s1")$ newfs /dev/da0s1
If the hard disk have existing partition table (equivalent to GEOM label), the following commands can be used to delete slices & index. The flow is first "Delete" then "Destroy".
E.g. Delete the slices first then Destroy the slices, Delete the GEOM label then Destroy the GEOM label (GEOM label is equivalent to partition table). :
Removing slice & index
- Delete the "slices" (repeat as needed),
$ gpart delete -i 1 da0s1
- Destroy "slices" (repeat as needed),
$ gpart destroy da0s1
- Delete the GEOM label,
$ gpart delete -i 1 da0
- Destroy the GEOM label,
$ gpart destroy da0
- On every step, verify the partition table :
$ gpart show da0
and
$ gpart list
- Step 4 is optional.
Some notes :
- Device id creation are done by kernel (automatically).
e.g. /dev/da0 <-- this device file will be automatically created when the kernel recognize the inserted hard disk - The below label are destroyable through the "gpart" utility :
- /dev/da0s1 <-- by gpart when creation (can be "destroy")
- /dev/da0s1a <-- by gpart when creation (can be "destroy")
- The MBR partitioning scheme has been around for too long and with limitation. It only allow 2 TB per partition and limit to 4 slices (or partition)
- Use GPT (guid partition table) partition scheme instead. It is new with big limits. The GPT partition scheme allows a partition or hard disk size of 9.4 ZB and up to 128 slices (aren't this too many :p)
- By the way, you'd most likely run into problem if using GPT partition should you run windows. Check it out here. Too bad :p
Further reference can refer to :
man gpartor
search for gpart manual pages at FreeBSD.org.
That's all for now,
Adios !!!
5 comments:
Thankyou, i have recently stopped using gnu/linux and gone to freebsd for the desktop. Was having alot of trouble finding a suitable filesystem to store backups (my current drives with xfs/ext3 mount readonly). Works perfectly now.
Thank you. Had a problem with ext3/xfs filesystems on freebsd (mounts readonly) which my current backups are stored on.
Stopped using gnu/linux recently and moved to freebsd for the desktop, so had a dilemma trying to write to my disks lol. Works perfectly using ufs though.
Cheers
A created partition didn't mount properly. Ofcourse I forgot `newfs`, thanks for pointing that part out in the article :>
Is there any way to use % in size instead of give actual size.
How can i specify size in % instead of actual size?
Post a Comment