
本文共 26274 字,大约阅读时间需要 87 分钟。
#######linux������������������##########
������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
##������#������������HDD��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� 7200 r/min��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� 0 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� 512Byte��������������������������������������������������������������������������������������������������������������������� 0 ������������������������������������������������������������������������������������"��������� x ��������� x ��������� x ���������������������#���������������������
IDE ���������������Integrated Drive Eectronics������������������������������������������������ "ATA������" ��� "PATA������"SATA ���������Serial ATA������������������������������������������������������������������������������������������������������������������SCSI ���������Small Computer System Interface������������������������������������������������������������������������������������������������������������������CPU ���������������������������������#������������SSD
������������������������������������������������������������������������������������������������������������DRAM���������������������������������������������������������������������������������������������������##������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������)������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#������������
��������������������������������������������������������������������������������������������������������� inode ������i ��������������������� inode ��������������������������������������������������� inode������������������inode ��������������������������������� block ��������������������������������������������� block ������������������������������������������������������������������������������ block ������������������������������������������������������������������������ block ��������������������������� super block��������������������������������������������������������������������� inode ��� block ���������������������������������������������������������������������������������������#���������������������������������������
/usr/src/kernels/������������������/fs[root@lgh ~]# ls /usr/src/kernels/3.10.0-514.16.1.el7.x86_64/fs/9p befs cifs devpts exofs f2fs gfs2 hppfs jffs2 logfs nfs_common ntfs proc ramfs sysvadfs bfs coda dlm exportfs fat hfs hugetlbfs jfs Makefile nfsd ocfs2 pstore reiserfs ubifsaffs btrfs configfs ecryptfs ext2 freevxfs hfsplus isofs Kconfig minix nilfs2 omfs qnx4 romfs udfafs cachefiles cramfs efivarfs ext3 fscache hostfs jbd Kconfig.binfmt ncpfs nls openpromfs qnx6 squashfs ufsautofs4 ceph debugfs efs ext4 fuse hpfs jbd2 lockd nfs notify overlayfs quota sysfs xfs#������������������
MBR���������Master Boot Record������������������������������������������������0���������������������������MBR���������������������������������������������������������������������������������������������MBR������446������������boot loader���������������������������������������boot loader���������������64������16��4������������������������������������������������Partition table������������������������1������������������������Partition table������������������������������������������������Partition id������������������������������������������������������������ Linux ������������������������������������������������������������ 3 ���������������������������������������������������������������������
0x5������ 0xf������������������������Extended partition������0x82���Linux ������������Swap partition������0x83��������� Linux ���������Linux partition������0x8e���Linux ������������������������Linux LVM partition������0xfd���Linux ��� RAID ���������Linux RAID auto partition��������������� MBR ������������������������������������ 64 ������������������������������������������ 16 ��������������������������������������������������������� 4 ������������������������������������������������������ 4 ���������������������������������������������������������������������������������������������������������������������
������������
##df
df ��������������������� Linux ������������������������������������������������������������������������������������������������������������������������������������������df ������������������������������������ Super block ������������������������df [������] [������������������]-a ������������������������������������������������������ /proc���/sysfs ������������������-m ��� MB ������������������������-k ��� KB ��������������������������������� KB ������������-h ��������������������� KB���MB ��� GB ������������������������������-T ���������������������������������������-i ������������������������������������������ inode ������������������#du
du ������������������������������������������������������������������du [������] [������������������]-a���������������������������������������������������������������������������������������-h������������������������������������������������ KB���MB ��� GB ������-s���������������������������������������������������������������������������������--max-depth=1 :���������������������������������������,���������������������������������������������[root@lgh zabbix]# ll
total 4-rw-r--r-- 1 zabbix zabbix 0 Sep 28 2018 output.txtdrwxrwxr-x 2 zabbix zabbix 4096 Jun 18 11:44 script[root@lgh zabbix]# du -h --max-depth=1124K ./script4.0K ./.ssh160K .#du���df������
df������������������������������������������������������������������������������������������������������������������������������������������du ���������������������������������������������������������������������������������������������df ������������������������������������������������������������#mount
������������������������������������������������������������������ Linux ��������������������������������������������������������������������������������������������������������������� Linux ���������#���������mount [������] -l ��������������� mount ��������������������������������������������������������������� -l ���������������������������������������-a ������������������������������������ /etc/fstab ���������������������������������������������������������������������������������������-t ���������������������������������������������������������Linux ������������������������ EXT2���EXT3���EXT4���iso9660���������������������vfat���reiserfs ��������������������������������������������� Linux ������������������-L ��������������������������������������������������� /dev/hdc6���������������������������������������������������������������������-n ��������������������������������������������������������������������� /etc/mtab ������������������������������������������������������������������������������������������������������������������������������������������������������-o ���������������������������������������������������������������������������������/���������������������������������������������������defaults��������������������������� rw���suid���dev���exec���auto���nouser���async ��� 7 ���������������rw/ro������������������������������������������������������rw ������������������������������������������ro ���������������������
async/sync���������������������������������������������sync���������������async������������������������������������ async���dev/nodev������������������������������������ block ������������������������������������������������������������ nodev���auto/noauto������������������������������������ mount -a ��������������������������������������� auto���suid/nosuid��������������������������������� SetUID ��� SetGID ���������������������������exec/noexec���������������������������������������������������������������������������������user/nouser��������������������������������������������������������� mount ������������������������������������������nouser������������ root ���������defaults������������������������������ rw���suid���dev���exec���auto���nouser���async ��� 7 ������������remount���������������������������������������������������������������������������������#���������������������
[root@lgh ~]# mkdir /mnt/disk1#������������[root@lgh ~]# mount /dev/sdb1 /mnt/disk1���#������������
[root@lgh ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom/ #-t iso9660������������������������������������#������u���
fdisk -l #������U���������������������mount -t vfat -o iocharset=utf8 /dev/sdb1 /mnt/usb/#������������
[root@lgh ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom/ #-t iso9660������������������������������������#������u���
fdisk -l #������U���������������������mount -t vfat -o iocharset=utf8 /dev/sdb1 /mnt/usb/##������������������������������
������/etc/fstab���������������[root@lgh zabbix]# cat /etc/fstab#
# /etc/fstab# Created by anaconda on Wed May 30 08:01:26 2018## Accessible filesystems, by reference, are maintained under '/dev/disk'# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#/dev/mapper/rootvg-rootlv / ext4 defaults 1 1UUID=35073a22-8611-4c98-a165-5abee7db9d0a /boot ext4 defaults 1 2/dev/mapper/rootvg-homelv /home ext4 defaults 1 2/dev/mapper/rootvg-swaplv swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0#####################
tmpfs���devpts���sysfs ��� proc ������������������������������������������������������������������������������������������������������������������������������������ fstab ������������������������������������ 6 ���������������������������������������1������������������������������������������������������������ UUID������������������������������2���������������3���������������������������4������������������������5������������������������ dump ���������0 ������������������1 ���������������2 ������������������������6������������������������ fsck ���������0 ���������������������������������������������������������1 ��������������� 2 ��������������������� 1 ��������������������� 2 ��������������������������������������� 1������������������������������ 2UUID ������������������������������������ 128 ��������������������������������������������������� ID���UUID ���������������������������������#umount
#���������umount ��������������������������������������������������������������������� umount ���������������������������������������������#fsck
��������������������������������������������������� root ��������������������������������������������������������������������������������������������������������������������������������������������������������� fsck ������������������������������������������������������������������������������������������������������������������������������ fsck ���������������������������������
#���������sck [������] ���������������������-a���������������������������������������������������������-r������������������������������������������������������������������������������������������������������������������-A��������� /etc/fstab ���������������������������������������������������������������������-t��������������������� ���������������������������������������-C������������������������������������-f������������������������ fsck ���������������������������������������������������������������������������������������������������������������������������������������-y��������������������� -a ������������������������������������������������ -y #dumpe2fs������������ dumpe2fs ������������������������������������������dumpe2fs [-h] ��������� # ������dumpe2fs /dev/mapper/VolGroup-LogVol01 -h-h ��������������������������� superblock������������������������������������������ dumpe2fs ��������������������������������������������������������������������� 2 ������������������������������������������������������������������������������������������������������������ inode ��� block ������������������ block ��� inode ���������������������������������������������
���������������Linux ���������������EXT ���������������������������������������������������������������block group��������� ������������������������������ inode/block/superblock ��������������������������������������������������������������������������������������������� Group0���Group1���#fdisk
fdisk ��������������������������������������������������� 2TB ������������������2TB���parted������
fdisk -l #������������������
fdisk <������������> #���������������������[root@lgh3 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors #������������������������������
Units = sectors of 1 * 512 = 512 bytes #���������������������Sector size (logical/physical): 512 bytes / 512 bytes#���������������������I/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000a3b98Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux/dev/sda2 2099200 62914559 30407680 8e Linux LVMDisk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x3a265abdDevice Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 8e Linux LVM/dev/sdb2 10487808 20973567 5242880 8e Linux LVM/dev/sdb3 20973568 31459327 5242880 8e Linux LVM #7���Disk /dev/mapper/centos-root: 27.9 GB, 27913093120 bytes, 54517760 sectors
Units = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-swap: 3221 MB, 3221225472 bytes, 6291456 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/scvg-lamplv: 4294 MB, 4294967296 bytes, 8388608 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes���������������������������������������������7������������������
Device������������������������������Boot������������������������������������������/dev/sda1������������������������Start������������������������������������������������End������������������������������������������������Blocks������������������������������KB���id���������������������������ID������fdisk������������������������"i"���������System���������������������������������������#fdisk���������������������������
[root@lgh3 ~]# fdisk /dev/sdb #���/dev/sdb������Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): mCommand action a toggle a bootable flag #��������������������� b edit bsd disklabel #������ bsd ������������ c toggle the dos compatibility flag #������ DOS ������������������������ d delete a partition #������������������ g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types #������������������������������������82 ��� Linux swap ���������83 ��� Linux ������ m print this menu #������������������ n add a new partition #������������ o create a new empty DOS partition table #������������ DOS ��������� p print the partition table #������������������ q quit without saving changes #��������������� s create a new empty Sun disklabel #������������ SUN ������������ t change a partition's system id #��������������������������� ID u change display/entry units #������������������������ v verify the partition table #��������������� w write table to disk and exit #������������ x extra functionality (experts only) #������������Command (m for help): q
#fdisk������������������������������
������������������������������������������"fdisk ��������� -> n(������)->p(���������������) -> 1(���������������) -> ������������������ 1 ���������������������������-> +2G(������������������)" -> w������������
������������������������������������������������������������������������������������������������3������������+������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������
#fdisk������������������
��������������������������������������������������������������������������������������������������������������������� partprobe ������
#partprobe
#parted
parted ��������������������������������������������������������������� parted ������������������������������������������������������������������������������������
parted <���������������������>
#################������������####################### check NUMBER #������������������������������������cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER #������������������������������������help [COMMAND] #���������������������������mklabel,mktable LABEL-TYPE #���������������������������������������mkfs NUMBER FS-TYPE #������������������������������mkpart PART-TYPE [FS-TYPE] START END #������������������mkpartfs PART-TYPE FS-TYPE START END #������������������������������������move NUMBER START END #������������name NUMBER NAME #���������������print [devices|free|list,all|NUMBER] #������������������������������������������������������������quit #������rescue START END #���������������������resize NUMBER START END #������������������rm NUMBER #������������select DEVICE #���������������������������set NUMBER FLAG STATE #������������������toggle [NUMBER [FLAG]] #������������������������unit UNIT #���������������������Version #������������
#mkfs
������������������������������������������������������������������������������������������������������������ mkfs ���������������������������������������mkfs [-t ������������������] ���������������������mkfs -t ext4 /dev/sdb2
#mke2fs
mke2fs [������] ���������������������-t ������������ #��������������������������������������� ��� ext2���ext3���ext4���-b ������ #������ block ������������-i ������ #������"������ inode "��������������������������������������������� inode���-j #������������ ext3 ������������������������������-L ��������� #��������������������������������������������� e2label ������������������mke2fs -t ext4 -b 2048 /dev/sdb2swap������
������swap ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������swap ���������������������������������������������������������������������������������2GB���
������������swap���������������������������������������������
1���������������������fdisk������������parted���������������������������2���������������������������������������������������mkswap���������������������������swap���������3���������swap���������������������������������������������������������
������������
mkswap /dev/sdb2
������������free������������
#swapon���swapoff
���������������������������
LVM
������LVM ���Logical Volume Manager������������������������������������������������������Linux������������������������������������������������������������������������LVM ���������������������������������������������������������������������������������������������������������������������������������������������
������LVM ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ Web ������������������������������������������������LVM ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PV������������������������������������������������������������������������VG������������������������������������������������������������������������LV������������ LVM ��������������������������������� block���������������������������Physical Extend���PE������������������������������������������������������������������(Physical Volume���PV)������������������������������������������
������(Volume Group���VG)���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(Logical Volume���LV)������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������(Physical Extend���PE)���PE ���������������������������������������������������������������������������PE������������PE���������������������������������������4MB���������������������������������LVM������������������������������������������������
1������������������������������������������������������������������������2���������������������������������������PV������������������������������������������������������������3���������������������������������VG���������������������������������������������������������������������������������������������������������������������������������������4������������������������������������LV���������������������������������������������������������������������������������������������������������������������������������������1������������������fdisk������������������Linux ��������������� ID 83��������������� LVM ��� ID 8e���������fdisk t���������
���������������
partprobe #������������������������������������������������
2���������������������pvcreate
pvcreate [���������������]pvcreate /dev/sdb5pvcreate /dev/sdb6pvcreate /dev/sdb7������������������pvscan������display
������������������pvremove
pvremove /dev/sdb7 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
3���������������
vgcreate [-s PE ������] ��������� ������������
[-s PE ������] ������������������������ PE ��������������������������� MB���GB���TB ������������������������������ PE ��������� 4MB���������������������������������������������������������������������������������������������������������������������������������������������������������
vgcreate -s 8MB scvg1 /dev/sdb5 /dev/sdb6 /dev/sdb7
#������
vgchange -a y ��������� #������������vgchange -a y ��������� #������������#������vgscan������vgdisplay
#������
vgextend scvg /dev/sdb7#������
vgreduce scvg /dev/sdb7#������
vgremove scvg4������������������
lvcreate [������] [-n ������������] ���������-L ������������������������������������������ MB���GB���TB ������-l ��������������� PE ���������������������������������������������������������������������������-n ������������������������������������lvcreate -L 3G -n lamplv scvg1 #���scvg1���������������������3GB���������lamplv���������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������"/dev/���������/������������"��������������� lamplv ������������������������"/dev/scvg/lamplv"mkfs -t ext4 /dev/scvg1/lamplvmkdir /disklvmmount /dev/scvg1/lamplv /disklvm/#������
lvscan
lvdisplay
#������������
#������������
lvresize [������] ���������������������������-L ��������������������������������������������� KB���GB���TB ������������ + ���������������- ���������������������������������������������������������������������������������������������-l ��������������� PE ������������������������������lvresize -L 4G /dev/scvg1/lamplv #���������4Glvresize -L +1G /dev/scvg1/lamplv #���������4Gresize2fs [������] [���������������] [���������������]
-f��������������������������������������������������������������������������������������������������������������������������������� M���G ������������������������������������������������������������resize2fs /dev/scvg1/lamplv#������
lvremove ������������������������������������������������������umount /dev/scvg1/lamplvlvremove /dev/scvg1/lamplv发表评论
最新留言
关于作者
