fdisk: Used to create/manage/delete partitions on linux operating system
# fdisk -cul /dev/sda
Shows information about partitions
Creating and using a partition:
1. Use fdisk to create a partition'
fdisk -cu /dev/sda
2. reboot the server
3. format the partition
mkfs -t ext4 /dev/sda4
4. Mount the partition
# mkdir /king
# mount /dev/sda4 /king
5. verify the mount
# df -h
Mounting FS permanenlty:
1. add the follwoing entry in /etc/fstab file
/dev/sda4 /king ext4 defaults 0 0
2. use the command 'mount -a'
How to unmount a partition:
umount /dev/sda4
(or)
umount /king
--------------------------------------------------------------------
How to mount a partition with UUID
1. generate UUID
# blkid /dev/sda5
2. Copy the UUID generated and add it in fstab file
ex:
UUID=980d09ds8f08sd0fsd0f8sd08 /king ext4 defautls 0 0
---------------------------------------------------------------------
managing swap partitions
````````````````````````
1. use 'fdisk' to create a new partition and change system ID to 82(Linux swap/solaris)
2. reboot the machine
3. format the swap partition
mkswap /dev/sda6
4. Add the entry in '/etc/fstab' file
/dev/sda6 swap swap defaults 0 0
swapon -a: to mount all swap partitions
`````````
swapon /dev/sda6 : only to mount specific partition
`````````````````
swapon -s: Show the list of swap partitions (used)
``````````
swapoff /dev/sda6: to unmount a swap partition
``````````````````
swapoff -a: to unmount all swap partitions
```````````
Comments
Post a Comment