Chapter9 Adding Disks Partitions and File Systems To A Linux System
Chapter9 Adding Disks Partitions and File Systems To A Linux System
- If the newly created partition should have a type other than Linux, enter the t
command to change a partition's type.
Hint)
[root@master ~]# dd if=/dev/random of=/dev/sdb bs=1M count=512 (to delete the
MBR of the hard disk)
- If no type is specified with mkfs command, (ext2) file system will be used.
==========================================
Managing GPT partitions with gdisk:
[root@master ~]# gdisk /dev/sdb
==========================================
Swap:
[root@master ~]# mkswap /dev/sdb1
[root@master ~]# swapon /dev/sdb1
[root@master ~]# swapon -a (activate all swap spaces listed in the
/etc/fstab file)
[root@master ~]# free -m (show the swap file system)
[root@master ~]# swapon -s (show the swap file system)
[root@master ~]# vim /etc/fstab
/dev/sdb2 swap ext4 defaults 0 0
[root@master ~]# swapoff /dev/sdb1
- Before moving the swap file to another location, swapoff must be run.
- If data cannot be written to other places, the swapoff will fail, with an error,
and the swap space will stay active.
- By default, swap spaces are used in series, meaning that the first activated swap
space will be used until it is full, then the kernel will start using the second
swap space. Swap space priorities are displayed with swapon - s, and can be set
with the pri= mount option. If swap spaces have the same priority, the kernel will
write to them round-robin instead of writing to a single swap space until it is at
capacity.
==========================================