-
Notifications
You must be signed in to change notification settings - Fork 3
/
Day 4 Linux Fundamentals, Storage management
210 lines (176 loc) · 3.53 KB
/
Day 4 Linux Fundamentals, Storage management
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
--------------------------------------------------------------------------------------
Disk Management in Linux | Managing Storage in RHEL 8
-----------------------------------------------------------------------------------------
lsblk
fdisdk -l
dmesg
lsscsi list SCSI devices (or hosts), list NVMe devices
lshw list hardware
cat /proc/scsi/scsi
save from data recovery
lsblk
badblocks -ws /dev/sda
dd if=/dev/zero off=/dev/sda
lsblk
attach harddisk with your running system
lsblk
now lest scan
ls /sys/class/scsi_host/ | while read host; do echo "- - -" > /sys/class/scsi_host/$host/scan; done
lsblk
for x in 'ls /sys/class/scsi_host/' | do echo "- - - - - $x Scaned- - - - -"; echo "- - -"> /sysclass/scsi_host/$x/scan; done
fdisk -l /dev/sda
used only for MBR only 4 primary partation craeted
GPT disk 128
gpdisk usd for created GPR password
cat /proc/partitions
Create PArtatiaon
fdisk /dev/sda
n
p
1
Enter
+2G
t
8e
w
partbrobe
lsblk
fdisk /dev/sda
n
p
1
Enter
+3G
w
partprobe
lsblk
fdisk -l /dev/sda
cat /proc/partitions
fdisk /dev/sda
n
e
Enter
1G
w
partprobe
lsblk
fdisk -l /dev/sda
For inster data in partation
mkdir Data
mount /dev/sda1 /Data
mkfs.xfs /dev/sda1
lsblk -f
mount /dev/sda1 /Data
df
cd /Data
touch test{a..z}
umount /dev/sda1 /Data
ls -ld /dev/sda
mkdir test
mount /dev/sda1 /test
cd test
ls
-------------------------------------------------------------------------------------------------
Filesystems & Mounting in Linux | Manage Filesystems in RHEL 8
-------------------------------------------------------------------------------------------------
man fs
cat /proc/filesystems
cat /etc/filesystems
man mount
lsblk
mke2fs /dev/sdb
blkid /dev/sdb
lsblk -f
tune2fs -l /dev/sdb |grep -i "block count"
incress brlock size
tune2fs -m10 /dev/sdb
tune2fs -l /dev/sdb |grep -i "block count"
cat /etc/fstab
df
mount
cat /etc/mtab
lsblk -f
copy uuid
vi /etc/fstab
UUID=PAST /test ext2 default 0 2
df
mount -a
df
man fstab
fsck /boot
umount /test
mount -t ext2 /dev/sdb /test/
df -Th
readonly mount
mount -t ext2 -o ro /dev/sdb /test
mount |grep sdb
cat /etc/mtab | grep sdb
mount /dev/sdb
mount -t ext2 -o noexec /dev/sdb /test
mount |grep sdb
cat /etc/mtab | grep sdb
cp -r /sbin/ifconfig /test
cd test
ll
./ifconfig
umount /test
mount -t ext2 -o noacl /dev/sdb /test/
cat /etc/mtab | grep sdb
cd test
touch a
setfacl -m u:zybi 7 a
--------------------------------------------------------------------------------------------
Convert EXT2 Into EXT3 & EXT4 | Enable/Disable Journaling Feature
---------------------------------------------------------------------------------------------
lsblk
attach disk with VM
for x in 'ls /sys/class/scsi_host/' | do echo "- - - - - $x Scaned- - - - -"; echo "- - -"> /sysclass/scsi_host/$x/scan; done
lsblk
fdisk /dev/sda
n
p
Enter
enter
w
partprobe
lsblk
lsblk -f
mke2fs /dev/sda1
blkid
lablk -f
tune2fs -l /dev/sda1 | grep feature
mkdir test
mount /dev/sda1 /test
df -hT
cd test
touch test{1..20}
cal > cal.txt
cd
Convert EXT2 to EXT3
umount /test
df -Th
tune2fs -j /dev/sda1
blkid /dev/sda1
tune2fs -l /dev/sda1 | grep feature
mount /dev/sda1 /test
cd test
cat cal
Convert EXT3 to EXT4
umount /test
df -Th
tune2fs -O extents,uninits_bg,dir_index /dev/sda1
blkid /dev/sda1
lsblk -f
mount /dev/sda1 /test
ll
cat cal.txt
Journaling Feature enable or disable
tune2fs -l /dev/sda1 | grep feature
umount /test
tune2fs -O ^has_journal /dev/sda1
tune2fs -l /dev/sda1 | grep feature
Enable Journaling
tune2fs -O has_journal /dev/sda1
tune2fs -l /dev/sda1 | grep feature
Mounting
vi etc/fstab