-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathManage-Basic-Storage.txt
More file actions
134 lines (96 loc) · 5.07 KB
/
Manage-Basic-Storage.txt
File metadata and controls
134 lines (96 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
What is Storage?
How we use disk on linux?
Default file system -- XFS, exfat 3, exfat4, vfat............
Mountpoint--Providing a directory to the filesystem.
For example: 500 GB HDD
4 Partitions -
100G --> XFS --> Mount Point(/) --> O/S
200G --> XFS --> Mount Point(/home) --> Users data
150G --> XFS --> Mount Point (/user) --> Pakages
50G --> XFS --> Mount POint(/backup) --> backup
-------------------------------------------------------------
Why we need partiotions?
- Data organisation, in sophesticated way.
- Security
- Easy to manage.
Dividing a physical storage into multiple logical part.
-----------------------------------------------------------
Partition Schema
MBR --
The Master Boot Record (MBR) partitioning scheme is the standard on systems that run BIOS
firmware. This scheme supports a maximum of four primary partitions. On Linux systems, with
extended and logical partitions, you can create up to 15 partitions. With a 32-bit partition size,
disks that are partitioned with MBR can have a size of up to 2 TiB.
BIOS -- Primary(4), Extended and Logical Partitions(15).
- - - - - - - -
GPT --
For systems that run Unified Extensible Firmware Interface (UEFI) firmware, GPT is the standard
for disk partitioning and addresses the limitations of the MBR scheme. A GPT provides a maximum
of 128 partitions. The GPT scheme allocates 64 bits for logical block addresses, to support
partitions and disks of up to eight zebibytes (ZiB) or eight billion tebibytes (TiB).
------------------------------------------------------------
Partition Editor
• fdisk is a historical favorite and has supported GPT partitions for years.
• gdisk and other fdisk variants were initially created to support GPT.
• parted and the libparted library have been the RHEL standard for years.
• The Anaconda installer continues to use the libparted library.
• gnome-disk is the default GNOME graphical tool, replacing gparted upstream.
• Almost all CLI editors are good for scripting, and parted was designed for it.
------------------------------------------------------------
Block Device Naming
Type of device Device naming pattern
SATA/SAS/USB-attached storage (SCSI driver) /dev/sda, /dev/sdb, /dev/sdc,...
virtio-blk paravirtualized storage(VMs) /dev/vda,/dev/vdb, /dev/vdc, .....
virtio-scsi paravirtualized storage(VMs) /dev/sda, /dev/sdb, /dev/sdc, ..
NVMe-attached storage (SSDs) /dev/nvme0, /dev/nvme1, ...
SD/MMC/eMMC Storage (SD cards) /dev/mmcblk0, /dev/mmcblk1, ..
-------------------------------------------------------------
###############################################Swap Storage#########################################
A swap space is an area of a disk under the control of the Linux kernel memory management
subsystem. The kernel uses swap space to supplement the system RAM by holding inactive pages
in memory. A system's virtual memory encompasses the combined system RAM and swap space.
RAM and Swap Space Recommendations
RAM Swap space Swap space if allowing for hibernation
2 GB or less Twice the RAM Three times the RAM
Between 2 GB and 8 GB Same as RAM Twice the RAM
Between 8 GB and 64 GB At least 4 GB 1.5 times the RAM
More than 64 GB At least 4 GB Hibernation is not recommended
-------------------------------------------------------------------------
lsblk -- list block devices.
example:
partition creation \\ This will create the temprory Swap only
fdisk /dev/sdc \This will run the fdisk tool. Explore the options
\ use these commands to create a partition and exit and save.
Try to create a partition and assign the partiton space.
partprobe /dev/sdc \To ping kernel to re-read the disk partition
mkfs.xfs /dev/sdc1 \Create file system with xfs in sdc1 mount point.
mkswap /dev/sdc2 \It prepares the disk partition or files to be used as swap space.
----------------------------------------------------------------------------
How to create Permanent Mount point and Swap.
By making the entry of the mount and swap in the fstab file.
vim /etc/fstab \ edit mode in file
#Format of fstab \You will need device name, UUID
\ You need Mountpoint of filesystem
\ Default of the filesystem
#use blkid \To list the UUID and device name
Mention the UUID in the fstab file \ Remove the qoutes
UUID=XXXXXXXX /data xfs defaults 0 0
/dev/sdc2 none swap defaults 0 0
\ This entry need to be done in the similar format.
####Systemctl dameon-reload ##########
####mount -a ######################### \This will help you check if the entry in fstab was right or wrong.
swapon /dev/sdc2 \to turn the swap on and this will remain permanent as long as the entry exist in fstab file.
--------------------------------------------------------
How to remove the permanent swap?
- Remove the entry from the fstab file.
- Run systemctl dameon-reload
- Run mount -a
- Check lsblk
- If swap is still showing run umount /data
- swapoff /dev/sdc2
- wipefs -a /dev/sdc1
- fdisk /dev/sdc
- Proceed to delete the partition.
- partprobe /dev/sdc
- run lsblk to list the files.
#####search about commands before running them ##############