Hard Disk Partitions In Linux:




Lsblk   কতগুলো হার্ডডিস্ক বা মিডিয়া ডিভাইস লাগানো আছে তা দেখার জন্য।
Df –h   পার্টিশন দেখার জন্য

hdparm -tt /dev/sda1 -for check hard disk performance speed
badblocks -s  -for show hdd bddside information
cfdisk -for manage partition (create delete execute)
Fdisk /dev/sda     {ec another hdd sdb}
N
P
No need to change just enter
+ 20GiB
W
OK
Partprobe /dev/sda   for use partition table without restart
Now have to format partition-
Mkfs.ext4 /dev/sda4   [we can use any partition type in instead of ext4]
Mkdir /tarzen [we can use any name]
Df –h
Mount /dev/sda4 /tarzan/
Df –h

We mount file till now as temporary we need to mount permanent. If we only want permanently mount we don’t need mount before only have to edit fstab file
Vi /etc/fstab

 Another terminal [ blkid] for uuid



:x
Mount file problem check command
Mount –a
We successfully create partition

For delete partion
Umount /dev/sda4
Or
Umount /tarzen/
Fdisk /dev/sda
D
P
W
Partprobe /dev/sda
Vi /etc/fstab
Have to put a # sign before this line which we enter before
:x
Mount –a
End Primary Partition


Extended Partition:

Fdisk /dev/sda
P
N
1st sector as it is as mentioned in system
Last sector +5G [as we want]
[We can’t use extended partition directly we have to create logical partition]
N
1st sector as it is
Last sector 1G
P
Partprobe /dev/sda
Mkfs.ext4 /dev/sad5
Mount /dev/sda5 /tarzen/
Df –h [show the tarzen size]
Vi /etc/fstab


:w
Mount –a
End Extended Partition

 Raid in Linux:


RAID-1

Fdisk –l
Fdisk /dev/sdb
n
p
w
Fdisk /dev/sdc
n
p
w
Fdisk /dev/sdb
t
fd
w
Fdisk /dev/sdc
t
fd
w
yum install mdadm* -y
mdadm –E /dev/sd[b-c]
mdadm  --create  /dev/md0 --level=mirror --raid-devices=2 /dev/sd[b-c]1
y
cat /proc/mdstat
mdadm –detail /dev/md0
mkfs.ext4 /dev/md0
mkdir /ironman
mount /dev/md0  /ironman/
df –h
cd /ironman/
ll
touch file
mkdir hello
ls
mdadm --detail –scan –verbose >> /etc/mdadm.conf
mdadm --detail /dev/md0
mdadm --manage /dev/md0 --fail /dev/sdc1
mdadm –detail /dev/md0
mdadm --manage /dev/md0 --remove /dev/sdc1
mdadm –detail /dev/md0

Raid-5:
fdisk –l
mdadm –c /dev/md0 - -level=raid5 - -raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
y
mkfs.ext4  /dev/md0
mount /dev/md0 /ironman/
df –h
mdadm - -detail /dev/md0
mdadm - -detail –scan - -verbose >> /etc/mdadm.conf 


Hard Disk Portions In Linux:
Lsblkকতগুলোহার্ডডিস্কবামিডিয়াডিভাইসলাগানোআছেতাদেখারজন্য।
Df –h   পার্টিশনদেখারজন্য
Fdisk /dev/sda     {ec another hddsdb}
N
P
No need to change just enter
+ 20GiB
W
OK
Partprobe /dev/sda   for use partition table without restart
Now have to format partition-
Mkfs.ext4 /dev/sda4   [we can use any partition type in instead of ext4]
Mkdir /tarzen [we can use any name]
Df –h
Mount /dev/sda4 /tarzan/
Mount –t ext4 /dev/sda4 /tarzan/ [if we want to specific file system mount]
Df–h

We mount file till now as temporary we need to mount permanent. If we only want permanently mount we don’t need mount before only have to edit fstab file
Vi /etc/fstab

Another terminal [ blkid] for uuid




:x
Mount file problem check command
Mount –a
We successfully create partition

For delete partion
Umount /dev/sda4
Or
Umount /tarzen/
Fdisk /dev/sda
D
P
W
Partprobe /dev/sda
Vi /etc/fstab
Have to put a # sign before this line which we enter before
:x
Mount –a
End Primary Partition


Extended Partition:

Fdisk /dev/sda
P
N
1st sector as it is as mentioned in system
Last sector +5G [as we want]
[We can’t use extended partition directly we have to create logical partition]
N
1st sector as it is
Last sector 1G
P
Partprobe /dev/sda
Mkfs.ext4 /dev/sad5
Mount /dev/sda5 /tarzen/
Df –h [show the tarzen size]
Vi /etc/fstab


:w
Mount –a
End Extended Partition



LVM Partition:


Logical volume Manager – we can extend reduce partition size in LVM other type can’t. we have create first physical volume then create logical volume. root boot swap not applicable.
fdisk /dev/sda
n
e
1                                             [whice partion want to create extended]              
first sector
last sector
n
l
partprobe /dev/sda
t                           [have to change partition linux lvm]
5                                  [select drive no]
8e
w
pvcreate /dev/sdb5 /dev/sdb6 /dev/sdb7               [for create physical volume]
pvdisplay
or
pvs
vgcreate vg1 /dev/sda5 /dev/sda6    [for create volume group]
vgdisplay or vgs
lvcreate –l +5g –n lv1 vg1
lvdisplay or lvs
mkfs.ext4 /dev/vg1/lv1
mkdir /lv_dir
mount /dev/vg1/lv1 /lv_dir/
from physical disk

pvcraete /dev/sda
pvcraete /dev/sdb
pvcraete /dev/sdc
pvscan –v
vgcreate vg1 /dev/sdb
vgextend vg1 /dev/sdc /dev/sdd  [use for extend or add new hdd]
pvscan –v
lvcreate –L 10G –n lv_1 vg1




lvextend –L +5G /dev/vg1/lv_1 [for extend logical volume partition size]
resize2fs /dev/vg1/lv_1
For reduce logcal volume size:
umount /spiderman/
e2fsck –f /dev/vg1/lv_1               [like defragment]
resize2fs /dev/vg1/lv_1 200M [after reduce size our volume will be 200M]
lvreduce –L 200M /dev/vg1/lv_1
mount /dev/vg1/lv_1 /spiderman/

fsck - for check file error
umount /dev/sda  - frist need unmount file
fsck /dev/sda

show number code-
1   file system error corrected
2   system should be rebooted
4  file system error left uncorrected
8   operational error
16   usage or syntax error
32  fsck cancelled by user
128   shared library error

No comments:

Post a Comment