Как создать файловую систему на диске или разделе?


Ответы

btrfs

mkfs.btrfs /dev/sda1

ext2/ext3/ext4

mkfs.ext2 /dev/sda1
mkfs.ext3 /dev/sda2
mkfs.ext4 /dev/vda

SquashFS

mksquashfs /dev/loop0

swap

mkswap /dev/sda2

UFS1/UFS2

newfs /dev/gpt/diskS

XFS

mkfs.xfs /dev/sda1

ZFS

RAID-Z (минимум три диска)

zpool create -m ${mountpoint} ${poolname} raidz /dev/gpt/disk0 /dev/gpt/disk1 /dev/gpt/disk2
zpool set bootfs=${poolname} ${poolname}
zfs set checksum=fletcher4 ${poolname}
zfs set atime=off ${poolname}

Создаем структуру папок с указанием параметров

zfs create ${poolname}/var
zfs create ${poolname}/var/db
zfs create -o exec=off -o setuid=off ${poolname}/var/empty
zfs set readonly=on ${poolname}/var/empty
zfs create ${poolname}/var/tmp
zfs create ${poolname}/var/empty
zfs create -o compression=gzip ${poolname}/var/crash
zfs create ${poolname}/tmp
zfs create ${poolname}/usr
zfs create -o compression=gzip -o mountpoint=${mountpoint}/usr/src ${poolname}/src
zfs create -o compression=gzip -o mountpoint=${mountpoint}/usr/ports ${poolname}/ports
zfs create -o mountpoint=${mountpoint}/usr/ports/distfiles ${poolname}/distfiles
zfs create -o mountpoint=${mountpoint}/usr/home ${poolname}/home
zfs create -o mountpoint=${mountpoint}/usr/local ${poolname}/local
zfs create -o mountpoint=${mountpoint}/usr/obj ${poolname}/obj
zfs create ${poolname}/data
chmod 1777 ${mountpoint}/tmp ${mountpoint}/var/tmp

где ${poolname} - имя пула