- 论坛徽章:
- 13
|
本帖最后由 ulovko 于 2012-08-31 21:55 编辑
创建 UFS:- ko# gpart show da0
- => 63 976773105 da0 MBR (465G)
- 63 488384064 1 freebsd [active] (232G)
- 488384127 488367873 2 ntfs (232G)
- 976752000 21168 - free - (10M)
- ko# gpart destroy -F da0
- da0 destroyed
- ko# gpart create -s gpt da0
- da0 created
- ko# gpart add -t freebsd-ufs -l koufs -s 250G da0
- da0p1 added
- ko# gpart show da0
- => 34 976773101 da0 GPT (465G)
- 34 524288000 1 freebsd-ufs (250G)
- 524288034 452485101 - free - (215G)
- > gpart show -l da0
- => 34 976773101 da0 GPT (465G)
- 34 524288000 1 koufs (250G)
- 524288034 452485101 - free - (215G)
复制代码 创建 UFS + NTFS:- ko# gpart destroy -F da0
- da0 destroyed
- ko# gpart create -s MBR da0
- da0 created
- ko# gpart show da0
- => 63 976773105 da0 MBR (465G)
- 63 976773105 - free - (465G)
- ko# gpart add -t freebsd -s 250G da0
- da0s1 added
- ko# gpart show da0
- => 63 976773105 da0 MBR (465G)
- 63 524287953 1 freebsd (250G)
- 524288016 452485152 - free - (215G)
- ko# gpart add -t ntfs da0
- da0s2 added
- ko# gpart show da0
- => 63 976773105 da0 MBR (465G)
- 63 524287953 1 freebsd (250G)
- 524288016 452485152 2 ntfs (215G)
- ko# gpart create -s bsd da0s1
- da0s1 created
- ko# gpart show da0s1
- => 0 524287953 da0s1 BSD (250G)
- 0 524287953 - free - (250G)
- ko# gpart add -t freebsd-ufs da0s1
- da0s1a added
- ko# mount /dev/da0s1a /media/
- ko# df
- Filesystem Size Used Avail Capacity Mounted on
- /dev/ada0p2 9.9G 649M 8.4G 7% /
- devfs 1.0k 1.0k 0B 100% /dev
- /dev/ada0p4 118G 26G 82G 24% /var
- /dev/ada0p5 2G 23M 1.8G 1% /tmp
- /dev/ada0p6 118G 45G 63G 42% /usr
- /dev/ada0p7 103G 64G 31G 67% /usr/home
- /dev/da0s1a 246G 8.0k 226G 0% /media
- /dev/fuse0 215G 71M 215G 0% /mnt
- ko# mount
- /dev/ada0p2 on / (ufs, local, journaled soft-updates)
- devfs on /dev (devfs, local, multilabel)
- /dev/ada0p4 on /var (ufs, local, journaled soft-updates)
- /dev/ada0p5 on /tmp (ufs, local, journaled soft-updates)
- /dev/ada0p6 on /usr (ufs, local, journaled soft-updates)
- /dev/ada0p7 on /usr/home (ufs, local, journaled soft-updates)
- /dev/da0s1a on /media (ufs, local, soft-updates)
- /dev/fuse0 on /mnt (fusefs, local, synchronous)
- ko# gpart show
- => 34 976773101 ada0 GPT (465G)
- 34 1024 1 freebsd-boot (512k)
- 1058 20971520 2 freebsd-ufs (10G)
- 20972578 16777216 3 freebsd-swap (8.0G)
- 37749794 251658240 4 freebsd-ufs (120G)
- 289408034 4194304 5 freebsd-ufs (2.0G)
- 293602338 251658240 6 freebsd-ufs (120G)
- 545260578 220200960 7 freebsd-ufs (105G)
- 765461538 209715200 8 freebsd-ufs (100G)
- 975176738 1596397 - free - (779M)
- => 63 976773105 da0 MBR (465G)
- 63 524287953 1 freebsd (250G)
- 524288016 452485152 2 ntfs (215G)
- => 0 524287953 da0s1 BSD (250G)
- 0 524287953 1 freebsd-ufs (250G)
复制代码 =======================================================- # more /sys/geom/part/g_part.c
- struct g_part_alias_list {
- const char *lexeme;
- enum g_part_alias alias;
- } g_part_alias_list[G_PART_ALIAS_COUNT] = {
- { "apple-boot", G_PART_ALIAS_APPLE_BOOT },
- { "apple-hfs", G_PART_ALIAS_APPLE_HFS },
- { "apple-label", G_PART_ALIAS_APPLE_LABEL },
- { "apple-raid", G_PART_ALIAS_APPLE_RAID },
- { "apple-raid-offline", G_PART_ALIAS_APPLE_RAID_OFFLINE },
- { "apple-tv-recovery", G_PART_ALIAS_APPLE_TV_RECOVERY },
- { "apple-ufs", G_PART_ALIAS_APPLE_UFS },
- { "bios-boot", G_PART_ALIAS_BIOS_BOOT },
- { "ebr", G_PART_ALIAS_EBR },
- { "efi", G_PART_ALIAS_EFI },
- { "fat32", G_PART_ALIAS_MS_FAT32 },
- { "freebsd", G_PART_ALIAS_FREEBSD },
- { "freebsd-boot", G_PART_ALIAS_FREEBSD_BOOT },
- { "freebsd-swap", G_PART_ALIAS_FREEBSD_SWAP },
- { "freebsd-ufs", G_PART_ALIAS_FREEBSD_UFS },
- { "freebsd-vinum", G_PART_ALIAS_FREEBSD_VINUM },
- { "freebsd-zfs", G_PART_ALIAS_FREEBSD_ZFS },
- { "linux-data", G_PART_ALIAS_LINUX_DATA },
- { "linux-lvm", G_PART_ALIAS_LINUX_LVM },
- { "linux-raid", G_PART_ALIAS_LINUX_RAID },
- { "linux-swap", G_PART_ALIAS_LINUX_SWAP },
- { "mbr", G_PART_ALIAS_MBR },
- { "ms-basic-data", G_PART_ALIAS_MS_BASIC_DATA },
- { "ms-ldm-data", G_PART_ALIAS_MS_LDM_DATA },
- { "ms-ldm-metadata", G_PART_ALIAS_MS_LDM_METADATA },
- { "ms-reserved", G_PART_ALIAS_MS_RESERVED },
- { "ntfs", G_PART_ALIAS_MS_NTFS },
- { "netbsd-ccd", G_PART_ALIAS_NETBSD_CCD },
- { "netbsd-cgd", G_PART_ALIAS_NETBSD_CGD },
- { "netbsd-ffs", G_PART_ALIAS_NETBSD_FFS },
- { "netbsd-lfs", G_PART_ALIAS_NETBSD_LFS },
- { "netbsd-raid", G_PART_ALIAS_NETBSD_RAID },
- { "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP },
- };
复制代码- PARTITION TYPES
- Partition types are identified on disk by particular strings or magic
- values. The gpart utility uses symbolic names for common partition types
- to avoid the user needing to know these values or other details of the
- partitioning scheme in question. The gpart utility also allows the user
- about its use.
- PARTITION TYPES
- Partition types are identified on disk by particular strings or magic
- values. The gpart utility uses symbolic names for common partition types
- to avoid the user needing to know these values or other details of the
- partitioning scheme in question. The gpart utility also allows the user
- to specify scheme-specific partition types for partition types that do
- not have symbolic names. The symbolic names currently understood are:
- bios-boot The system partition dedicated to second stage of the boot
- loader program. Usually it used by GRUB 2 loader when the
- partition table is GPT. The scheme-specific type is
- "!21686148-6449-6E6F-744E-656564454649".
- efi The system partition for computers that use the Extensible
- Firmware Interface (EFI). In such cases, the GPT parti‐
- tioning scheme is being used and the actual partition type
- for the system partition can also be specified as
- "!c12a7328-f81f-11d2-ba4b-00a0c93ec93ab".
- freebsd A FreeBSD partition that uses the BSD disklabel to sub-
- divide the partition into file systems. This is a legacy
- partition type and should not be used for the APM or GPT
- schemes. The scheme-specific types are "!165" for MBR,
- "!FreeBSD" for APM, and
- "!516e7cb4-6ecf-11d6-8ff8-00022d09712b" for GPT.
- freebsd-boot A FreeBSD partition dedicated to bootstrap code. The
- scheme-specific type is
- "!83bd6b9d-7f41-11dc-be0b-001560b84f0f" for GPT.
- freebsd-swap A FreeBSD partition dedicated to swap space. The scheme-
- specific types are "!FreeBSD-swap" for APM,
- "!516e7cb5-6ecf-11d6-8ff8-00022d09712b" for GPT, and tag
- 0x0901 for VTOC8.
- freebsd-ufs A FreeBSD partition that contains a UFS or UFS2 file sys‐
- tem. The scheme-specific types are "!FreeBSD-UFS" for
- APM, "!516e7cb6-6ecf-11d6-8ff8-00022d09712b" for GPT, and
- tag 0x0902 for VTOC8.
- freebsd-vinum A FreeBSD partition that contains a Vinum volume. The
- scheme-specific types are "!FreeBSD-Vinum" for APM,
- "!516e7cb8-6ecf-11d6-8ff8-00022d09712b" for GPT, and tag
- 0x0903 for VTOC8.
- freebsd-zfs A FreeBSD partition that contains a ZFS volume. The
- scheme-specific types are "!FreeBSD-ZFS" for APM,
- "!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT, and
- 0x0904 for VTOC8.
- mbr A partition that is sub-partitioned by a master boot
- record (MBR). This type is known as
- "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT.
复制代码
- > man gpart
- EXAMPLES
- Create GPT scheme on ad0:
- /sbin/gpart create -s GPT ad0
- Embed GPT bootstrap code into protective MBR:
- /sbin/gpart bootcode -b /boot/pmbr ad0
- Create a dedicated freebsd-boot partition that can boot FreeBSD from a
- freebsd-ufs partition, and install bootstrap code into it. This parti‐
- tion must be larger than /boot/gptboot, or the GPT boot you are planning
- to write, but smaller than 545 KB. A size of 15 blocks (7680 bytes)
- would be sufficient for booting from UFS but let's use 128 blocks (64 KB)
- here in this example, in order to reserve some space for potential future
- need (e.g. from a ZFS partition).
- /sbin/gpart add -b 34 -s 128 -t freebsd-boot ad0
- /sbin/gpart bootcode -p /boot/gptboot -i 1 ad0
- Create a 512MB-sized freebsd-ufs partition that would contain UFS where
- the system boots from:
- /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0
- Create MBR scheme on ada0, then create 30GB-sized FreeBSD slice, mark it
- active and install boot0 boot manager:
- /sbin/gpart create -s MBR ada0
- /sbin/gpart add -t freebsd -s 30G ada0
- /sbin/gpart set -a active -i 1 ada0
- /sbin/gpart bootcode -b /boot/boot0 ada0
- Now create BSD scheme (BSD label) with ability to have up to 20 parti‐
- tions:
- /sbin/gpart create -s BSD -n 20 ada0s1
- Create 1GB-sized UFS partition and 4GB-sized swap partition:
- /sbin/gpart add -t freebsd-ufs -s 1G ada0s1
- /sbin/gpart add -t freebsd-swap -s 4G ada0s1
- Install bootstrap code for the BSD label:
- /sbin/gpart bootcode -b /boot/boot ada0s1
- Create VTOC8 scheme on da0:
- /sbin/gpart create -s VTOC8 da0
- Create a 512MB-sized freebsd-ufs partition that would contain UFS where
- the system boots from:
- /sbin/gpart add -s 512M -t freebsd-ufs da0
- Create a 15GB-sized freebsd-ufs partition that would contain UFS and
- aligned on 4KB boundaries:
- /sbin/gpart add -s 15G -t freebsd-ufs -a 4k da0
- After having created all required partitions, embed bootstrap code into
- them:
- /sbin/gpart bootcode -p /boot/boot1 da0
- Create backup of partition table from da0:
- /sbin/gpart backup da0 > da0.backup
- Restore partition table from backup to da0:
- /sbin/gpart restore -l da0 < /mnt/da0.backup
- Clone partition table from ada0 to ada1 and ada2:
- /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2
复制代码 =======================================================================
FROM: http://lists.freebsd.org/piperma ... 11-July/232374.html
On 7/28/2011 7:55 AM, Kevin Oberman wrote:
> I want to create a GPT disk structure that has the following partitions:
> MBR
> NTFS (1.2G)
> NTFS (200G)
> FreeBSD OS (250G)
> NTFS (15G)
> FAT-32 (100G) (needs to be RW for W7 and FreeBSD and ntfs-3g is just
> not stable enough)
> FreeBSD data only (380G)
>
> The NTFS partitions are to place the Windows7 system, recovery
> partition (which I may
> not use), and Lenovo's odd "SYSTEM_DRV" that is required for booting.
> gpart has no
> indications of how to create an NTFS or FAT partition. Any way to so
> this? Or, should I
> use W7 to do that and leave the space for the FreeBSD ones?
No, you can do this with gpart.
gpart knows the following MS related GUIDs. The types you need
to use in -t are ms-basic-data, ms-ldm-data etc.
> { "ms-basic-data", G_PART_ALIAS_MS_BASIC_DATA },
> { "ms-ldm-data", G_PART_ALIAS_MS_LDM_DATA },
> { "ms-ldm-metadata", G_PART_ALIAS_MS_LDM_METADATA },
> { "ms-reserved", G_PART_ALIAS_MS_RESERVED },
> { "ntfs", G_PART_ALIAS_MS_NTFS },
I don't know which partition types you should use for the
wanted partitioning scheme.
The struct that defines the known gpart GUIDs is in
/sys/geom/part/g_part.c at line 69(on HEAD).
HTH, Nikos |
|