-
Notifications
You must be signed in to change notification settings - Fork 0
gnu linux disk
arvin karimi edited this page Apr 5, 2018
·
1 revision
cat /proc/scsi/scsi
yum install lsscsi
cat /proc/scsi/scsi
ls /sys/class/scsi_host
echo "- - -" > /sys/class/scsi_host/host#/scan
fdisk -l
tail -f /var/log/message
echo 1 > /sys/block/sdc/device/delete
fdisk -l
fdisk /dev/sdx
options :
- n – create a new partition
- p – print the partition table
- can specify size , start and endpoint
- d – delete a partition
- w – write the new partition table and exit
- q – quit without saving changes
mkdir /disk1
mount /dev/sdx /disk1
df -H
- mount automaticaly on reboot ( add to /etc/fstab)
/dev/sdx /disk1 ext3 defaults 1 2
apt install lvm2
yum install lvm2*
systemctl enable lvm2-lvmetad.service
systemctl enable lvm2-lvmetad.socket
systemctl start lvm2-lvmetad.service
systemctl start lvm2-lvmetad.socket
pvcreate used to prepare a disk partition or a whole disk for use by LVM
pvcreate /dev/sd
To get LVM's internal view and details, use LVM commands Lists : use the lvs and pvs commands with option --segments Detailed view: use the lvdisplay and pvdisplay commands with option -m 1- lvs
- List the physical segments used by a logical volume :
lvs --segments /dev/vg_ssd/lv_videos -o +lv_size,devices
- List the physical extents of a given LV. Useful to move those segments (using pvmove):
lvs /dev/vg_ssd/lv_videos -o seg_pe_ranges
3- lvdisplay
- List the physical segments of a given logical volume, among other information:
lvdisplay -m /dev/vg_ssd/lv_videos
4- pvdisplay
- Display the Logical volume associated with a given physical volume , among other information:
pvdisplay -m /dev/sdb1
5- pvs
- list the logical volume (segments) inside a given Physical Volume:
pvs /dev/sdb1 --segments -o +lv_name,lv_size
- Complex command, but full list :
pvs --segments -o pv_name,pv_size,seg_size,vg_name,lv_name,lv_size,seg_pe_ranges
At least one physical volume is required to create a volume group.
vgcreate
vgcreate testvg /dev/sdx1 /dev/sdx2 ...
vgdisplay testvg #testvg is optional
lvcreate -n lv_data1 --size 12G testvg
- options: -n : volume name --size[-L] : volume lv size -p{r|rw} : permision -M{y|n} : persistent
lvdisplay