Linux ´ÅÅÌ·ÖÇøºÍ¹ÒÔØ
Linux ´ÅÅÌ·ÖÇøºÍ¹ÒÔØ
linux ·ÖÇø
ÔÀíÏÈÈÝ
1.Linux À´Ëµ wulun Óм¸¸ö·ÖÇø£¬·Ö¸øÄÄһĿ¼ʹÓã¬Ëû¹é¸ù½áµ×Ö»ÓÐÒ»¸ö¸ùĿ¼£¬Ò»¸ö×ÔÁ¦ÇÒΨһµÄÎļþ½á¹¹£¬Linux ÖÐÿ¸ö·ÖÇø¶¼ÊÇÓÃÀ´×é³ÉÕû¸öÎļþϵͳµÄÒ»²¿·Ö¡£
2.Linux ½ÓÄÉÁËÒ»ÖֽР“ÔØÈë” µÄ´¦ÀíÒªÁ죬ËüµÄÕû¸öÎļþϵͳÖаüÀ¨ÁËÒ»ÕûÌ×µÄÎļþºÍĿ¼£¬ÇÒ½«Ò»¸ö·ÖÇøºÍÒ»¸öĿ¼ÁªÏµÆðÀ´£¬ÕâÊÇÒªÔØÈëµÄÒ»¸ö·ÖÇø½«Ê¹ËüµÄ´æ´¢¿Õ¼äÔÚÒ»¸ö£¬Ä¿Â¼Ï»ñµÃ¡£
·ÖÇøºÍÎļþ¹ØϵʾÒâͼ£º
Ó²ÅÌ˵Ã÷
1.Linux Ó²ÅÌ·Ö IDE Ó²ÅÌºÍ SCSI Ó²ÅÌ£¬ÏÖÔÚ»ù±¾ÉÏÊÇ SCSI Ó²ÅÌ
2.¹ØÓÚIDE Ó²ÅÌ£¬Çý¶¯Æ÷±êʶ·ûΪ “hdx~”£¬ÆäÖÐ “hd” Åú×¢·ÖÇøËùÔÚ×°±¸µÄÀàÐÍ£¬ÕâÀïÊÇÖ¸ IDE Ó²ÅÌÁË¡£”x” ΪÅ̺Š(a Ϊ»ù±¾ÅÌ£¬b Ϊ»ù±¾Á¥ÊôÅÌ£¬c Ϊ¸¨ÖúÖ÷ÅÌ£¬d Ϊ¸¨ÖúÁ¥ÊôÅÌ)£¬”~” ´ú±í·ÖÇø£¬Ç°Ëĸö·ÖÇøÓÃÊý×Ö 1 µ½ 4 ÌåÏÖ£¬ËüÃÇÊÇÖ÷·ÖÇø»òÀ©Õ¹·ÖÇø£¬´Ó 5 ×îÏȾÍÊÇÂß¼·ÖÇø¡£Àý£¬hda3 ÌåÏÖΪµÚÒ»¸ö IDE Ó²ÅÌÉϵĵÚÈý¸öÖ÷·ÖÇø»òÀ©Õ¹·ÖÇø£¬hdb2 ÌåÏÖΪµÚ¶þ¸ö IDE Ó²ÅÌÉϵĵڶþ¸öÖ÷·ÖÇø»òÀ©Õ¹·ÖÇø¡£
3.¹ØÓÚSCSI Ó²ÅÌÔò±êʶΪ “sdx~”£¬SCSI Ó²ÅÌÊÇÓà “sd” À´ÌåÏÖ·ÖÇøËùÔÚ×°±¸µÄÀàÐ͵ģ¬ÆäÓàÔòºÍ IDE Ó²Å̵ÄÌåÏÖÒªÁìÒ»Ñù£¨x ¿ÉÒÔΪ abcd »®·Ö¶ÔÓ¦µÚ 1¡¢2¡¢3¡¢4 ¿éÓ²ÅÌ£©¡£
Éó²éËùÓÐ×°±¸¹ÒÔØÇéÐÎ
Ö¸Álsblk »òÕß lsblk -f
[root@kongchao03 ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 20G 0 disk ©À©¤sda1 8:1 0 1023M 0 part /boot©À©¤sda2 8:2 0 17G 0 part /©¸©¤sda3 8:3 0 2G 0 part [SWAP]sr0 11:0 1 729.9M 0 rom /run/media/root/20210907_143734[root@kongchao03 ~]#
µÇ¼ºó¸´ÖÆ
ÕâÀï sda1¡¢2¡¢3 »®·Ö´ú±íµÚÒ»¿éÓ²Å̵ĵÚÒ»·ÖÇøµÚ¶þ·ÖÇø…
¹ÒÔØ°¸Àý
°ì·¨ 1£ºÐ½¨Ò»¿éÓ²ÅÌ
ÔÚÐéÄâ»ú²Ëµ¥ÖУ¬ÉèÖÃÔöÌíÒ»¿éÓ²ÅÌ£¬Íê³ÉºóÖØÆô¿ÉÒÔÉúЧʶ±ð¡£ÁíÍ⣬ËÑË÷ÃñÖÚºÅLinux¾Í¸ÃÕâÑùѧºǫ́»Ø¸´¡°Linux¡±£¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£
ʹÓà lsblk ÏÂÁîÉó²é
²Ù×÷°ì·¨ 2£ºÐéÄâ»úÓ²ÅÌ·ÖÇø
·ÖÇøÖ¸Áfdisk /dev/sdb
×îÏÈ¶Ô sdb ·ÖÇø
m ÏÔʾÏÂÁîÁбí
p ÏÔʾ´ÅÅÌ·ÖÇøͬ fdisk -l
n ÐÂÔö·ÖÇø
d ɾ³ý·ÖÇø
w дÈë²¢Í˳ö
˵Ã÷£º×îÏÈ·ÖÇøºóÊäÈë n£¬ÐÂÔö·ÖÇø£¬È»ºóÑ¡Ôñ p£¬·ÖÇøÀàÐÍΪÖ÷·ÖÇø¡£Á½´Î»Ø³µÄ¬ÈÏÊ£ÓàËùÓпռ䣬×îºóÊäÈë w дÈë·ÖÇø²¢Í˳ö£¬Èô²»ÉúÑÄÍ˳öÊäÈë q
[root@kongchao03 ~]# fdisk /dev/sdb½Ó´ýʹÓà fdisk (util-linux 2.23.2)¡£ > ¸ü¸Ä½«Í£ÁôÔÚÄÚ´æÖУ¬Ö±µ½Äú¾öÒ齫¸ü¸ÄдÈë´ÅÅÌ¡£Ê¹ÓÃдÈëÏÂÁîÇ°ÇëÈý˼¡£ > Device does not contain a recognized partition table>> ʹÓôÅÅ̱êʶ·û 0xdf03b737 ½¨ÉèÐ嵀 DOS ´ÅÅ̱êÇ©¡£ ÏÂÁî(ÊäÈë m »ñÈ¡×ÊÖú)£ºm ÏÂÁî²Ù×÷ a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)ÏÂÁî(ÊäÈë m »ñÈ¡×ÊÖú)£ºnPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): p·ÖÇøºÅ (1-4£¬Ä¬ÈÏ 1)£º1Æðʼ ÉÈÇø (2048-2097151£¬Ä¬ÒÔΪ 2048)£º½«Ê¹ÓÃĬÈÏÖµ 2048Last ÉÈÇø, +ÉÈÇø or +size{K,M,G} (2048-2097151£¬Ä¬ÒÔΪ 2097151)£º½«Ê¹ÓÃĬÈÏÖµ 2097151·ÖÇø 1 ÒÑÉèÖÃΪ Linux ÀàÐÍ£¬¾ÞϸÉèΪ 1023 MiBÏÂÁî(ÊäÈë m »ñÈ¡×ÊÖú)£ºwThe partition table has been altered!Calling ioctl() to re-read partition table.ÕýÔÚͬ²½´ÅÅÌ¡£[root@kongchao03 ~]#
µÇ¼ºó¸´ÖÆ
°ì·¨ 3£ºÐéÄâ»úÓ²ÅÌ·ÖÇøÃûÌû¯
ÃûÌû¯´ÅÅÌ£¬ÃûÌû¯Ö®ºó²Å»á·ÖÅÉ UUID
ÃûÌû¯Ö¸Ámkfs -t ext4 /dev/sdb1
ÆäÖÐ ext4 ÊÇ·ÖÇøÀàÐÍ
mkfs -t ext4 /dev/sdb1lsblk -f
µÇ¼ºó¸´ÖÆ
°ì·¨ 4£º½«´ÅÅ̹ÒÔص½¸ùĿ¼Ï newdisk Ŀ¼ÏÂ
Ò²¿ÉÒÔµ½ÆäËûĿ¼Ï¹ÒÔØ£º½«Ò»¸ö·ÖÇøÓëÒ»¸öĿ¼ÁªÏµÆðÀ´£¬
mount ¹ÒÔØ
Å£±Æ°¡£¡½Ó˽»î±Ø±¸µÄ N ¸ö¿ªÔ´ÏîÄ¿£¡¸ÏæÕä²Ø
µÇ¼ºó¸´ÖÆ
¹ÒÔØÓï·¨£ºmount ×°±¸Ãû³Æ ¹ÒÔØĿ¼ £¨¹ÒÔØĿ¼ÊÇí§ÒâµÄ£©
[root@kongchao03 ~]# cd / [root@kongchao03 /]# mkdir newdisk [root@kongchao03 /]# mount /dev/sdb1 /newdisk [root@kongchao03 /]# lsblk -f
µÇ¼ºó¸´ÖÆ
cd ½øÈë¹ÒÔص㣬ÔÚÆäÖн¨ÉèÎļþ£¬ÊµÔòÊÇÔÚ·ÖÇøÉÏн¨ÁËÒ»¸öÎļþ
linux ¸ùϵĴæ·ÅÖ»ÊÇĿ¼£¬ÕæÕý´æ·ÅÊý¾ÝÕÕ¾ÉÔÚÓ²ÅÌÖеķÖÇø
umount ×÷·Ï¹ÒÔØ
Óï·¨:umount ¹ÒÔصã»ò umount ×°±¸Ãû
umount /dev/sdb1 lsblk -f
µÇ¼ºó¸´ÖÆ
ÓÃÏÂÁîÐйÒÔØ£¨mount /dev…£©£¬ÖØÆôºó»áʧЧ, ¼´ÖØÆôºó¹ÒÔصãÏûÊÅ
°ì·¨ 5£ºÊµÏÖÓÀÊÀ¹ÒÔØ£¨¼´ÖØÆô²»±Øʧ£©
ÓÀÊÀ¹ÒÔصÄʵÖÊÊÇ×Ô¶¯¹ÒÔØÉÏ
ÓÀÊÀ¹ÒÔØ£ºÍ¨¹ýÐÞ¸Ä/etc/fstab ʵÏÖ¹ÒÔØ
Ìí¼ÓÍê³ÉºóÖ´ÐÐmount -a »ò reboot ¼´¿ÉÉúЧ
[root@kongchao03 /]# vim /etc/fstab [root@kongchao03 /]# mount -a
µÇ¼ºó¸´ÖÆ
df -h ÅÌÎÊ´ÅÅÌʹÓÃÇéÐÎ
[root@kongchao03 ~]# df -h Îļþϵͳ ÈÝÁ¿ ÒÑÓà ¿ÉÓà ÒÑÓÃ% ¹ÒÔصã /dev/sda2 17G 5.8G 11G 37% / devtmpfs 978M 0 978M 0% /dev tmpfs 993M 0 993M 0% /dev/shm tmpfs 993M 9.0M 984M 1% /run tmpfs 993M 0 993M 0% /sys/fs/cgroup /dev/sdb1 991M 2.6M 922M 1% /newdisk /dev/sda1 991M 128M 797M 14% /boot tmpfs 199M 20K 199M 1% /run/user/0 /dev/sr0 730M 730M 0 100% /run/media/root/20210907_143734 [root@kongchao03 ~]#
µÇ¼ºó¸´ÖÆ
du -h ÅÌÎÊÖ¸¶¨Ä¿Â¼´ÅÅÌÕ¼ÓÃÇéÐÎ
Ö¸Ádu [²ÎÊý] / Ŀ¼ (ÅÌÎÊÖ¸¶¨Ä¿Â¼µÄ´ÅÅÌÕ¼ÓÃÇéÐΣ¬Ä¬ÒÔΪĿ½ñĿ¼)
²ÎÊýÑ¡Ï
²ÎÊý | ¼ÄÒå |
-s | Ö¸¶¨Ä¿Â¼Õ¼ÓþÞϸ»ã×Ü |
-h | ´ø¼ÆÁ¿µ¥Î» |
-a | º¬Îļþ |
–max-depth=1 | ×ÓĿ¼µÄÉî¶È |
-c | ÁгöÃ÷ϸµÄͬʱ£¬ÔöÌí»ã×ÜÖµ |
²ÎÊý¿ÉÒÔÍŽáʹÓÃʾÀý£ºÅÌÎÊ / opt Ŀ¼µÄ´ÅÅÌÕ¼ÓÃÇéÐΣ¬Éî¶ÈΪ 1
[root@kongchao03 /]# cd /opt [root@kongchao03 opt]# ls rh [root@kongchao03 opt]# du -h --max-depth=1 /opt 4.0K /opt/rh 8.0K /opt [root@kongchao03 opt]#
µÇ¼ºó¸´ÖÆ
²ÎÊýÍŽáÆðÀ´Ê¹ÓÃ:
[root@kongchao03 opt]# du -hac --max-depth=1 /opt 4.0K /opt/rh 8.0K /opt 8.0K ×ÜÓÃÁ¿
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇLinux ´ÅÅÌ·ÖÇøºÍ¹ÒÔصÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡