fdisk is the traditional partitioning tool for MBR disks:
fdisk [disk device]
fdisk will wait for one of these commands:
|p||display current partition table|
|d||delete a partition|
|l||list type codes|
|a||flag as bootable|
|q||quit without saving|
|w||write changes and exit|
If you’re working with GPT, you’ll need to use gdisk. The commands are the same as above.
GPT doesn’t use primary, extended or logical partitions, they’re all the same. Use parted to create a GPT disk.
Common filesystem types
|Ext2fs||traditional Linux-native fylesystem; can be a good choice for a small /boot partitition, type code is ext2|
|Ext3fs||like ext3fs but with journaling, type code is ext3|
|Ext4fs||works with very large disks (over 16TiB) or very large files (over 2TiB), type code is ext4|
|ReiserFS||journaling filesystem for Linux; very good at handling large numbers of small files (smaller than 32KB), type code is reiserfs|
|JFS||journaled filesystem by IBM for AIX, type code is jfs|
|Btrfs||advanced filesystem inspired by ZFS (Zettabyte filesystem) and it’s able to handle very large disks and files|
|FAT, vFAT||File Allocation Table supported by DOS. Names are limited to 8 characters (8.3 filenames), type code is msdos|
|NTFS||new technology filesystem|
|HFS, HFS+||hierarchical filesystem used on MacOS|
|ISO-9660||standards filesystem for CD-ROMs|
|UDF||Universal Disk Format, used on DVD-ROMs|
Creating a filesystem
mkfs -t [fstype]
-c is used for bad-block checks.
Linux provides tools for non-Linux filesystems like mkdosfs, mkfs.msdos or mkfs.vfat. -F [fat-size] is to specify FAT size in bits, 12-16-32
Creating swap space
Type code is 0x82
Linux uses /etc/fstab to define which partitions to use as swap.
mkswap create swap space and swapon will activate it. To activate it permanently, you have to edit /etc/fstab.