Linux纾佺洏鎸傝浇
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux纾佺洏鎸傝浇相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%8c%82%e8%bd%bd%e7%82%b9' title='鎸傝浇鐐?>鎸傝浇鐐?/a> 榛樿 The 鍏夌洏 only max 浣滅敤 exe
mount鍛戒护 鐢ㄤ簬鍔犺浇鏂囦欢绯荤粺鍒版寚瀹氱殑鍔犺浇鐐广€傛鍛戒护鐨勬渶甯哥敤浜庢寕杞絚drom锛屼娇鎴戜滑鍙互璁块棶cdrom涓殑鏁版嵁锛屽洜涓轰綘灏嗗厜鐩樻彃鍏drom涓紝Linux骞朵笉浼氳嚜鍔ㄦ寕杞斤紝蹇呴』浣跨敤Linux mount鍛戒护鏉ユ墜鍔ㄥ畬鎴愭寕杞姐€?/span>
纾佺洏鏍煎紡鍖栧畬鎴愬悗闇€瑕佹寕杞藉悗鎵嶈兘杩涜鍘讳娇鐢ㄣ€傚湪鎸傝浇鏌愪釜鍒嗗尯鍓嶉渶瑕佸厛寤虹珛涓€涓寕杞界偣锛岃繖涓寕杞界偣鏄互鐩綍鐨勫舰寮忓嚭鐜扮殑銆備竴鏃︽妸鏌愪竴涓垎鍖烘寕杞藉埌浜嗚繖涓寕杞界偣锛堢洰褰曪級涓嬶紝閭d箞鍐嶅線杩欎釜鐩綍鍐欐暟鎹椂锛屽垯閮戒細鍐欏埌璇ュ垎鍖轰腑銆?/div>
娉ㄦ剰锛氬湪纾佺洏鎸傝浇鍒嗗尯鍓嶏紝鎸傝浇鐐逛笅蹇呴』鏄┖鐩綍锛屽洜涓虹鐩樻寕杞藉悗璇ョ洰褰曚笅涔嬪墠鐨勪笢瑗垮氨鐪嬩笉鍒颁簡锛屽彧鏈夊嵏杞藉垎鍖哄悗鎵嶈兘鐪嬪埌銆?/span>
璇存槑锛氬鏋滀竴鍙版湇鍔″櫒涓婃湁澶氬潡纾佺洏锛岃繘琛屾寕杞芥椂浼樺厛閫夌敤UUID锛岄伩鍏嶅彂鐢熺‖浠剁淮淇洿鎹㈢鐩樹綅缃悗纾佺洏鍒嗗尯鍚嶅彂鐢熷彉鍖栬€屽奖鍝嶇郴缁熷惎鍔ㄣ€?/span>
閫夐」锛?/span>
-V锛氭樉绀虹▼搴忕増鏈紱
-l锛氭樉绀哄凡鍔犺浇鐨勬枃浠剁郴缁熷垪琛紱
-h锛氭樉绀哄府鍔╀俊鎭苟閫€鍑猴紱
-v锛氬啑闀挎ā寮忥紝杈撳嚭鎸囦护鎵ц鐨勮缁嗕俊鎭紱
-n锛氬姞杞芥病鏈夊啓鍏ユ枃浠垛€?etc/mtab鈥濅腑鐨勬枃浠剁郴缁燂紱
-r锛氬皢鏂囦欢绯荤粺鍔犺浇涓哄彧璇绘ā寮忥紱
-a锛氬姞杞芥枃浠垛€?etc/fstab鈥濅腑鎻忚堪鐨勬墍鏈夋枃浠剁郴缁熴€?/div>
涓嶅垎鍖烘牸寮忓寲鏁村潡纾佺洏
[[email protected] ~]# fdisk /dev/sdb #鍒犻櫎鎵€鏈夊垎鍖?/span>
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): p #鍒楀嚭鍒嗗尯
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x189fc246
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 83 Linux
Command (m for help): d #鍒犻櫎鍒嗗尯
Selected partition 1
Partition 1 is deleted
Command (m for help): w #淇濆瓨閫€鍑?/div>
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] ~]# fdisk -l /dev/sdb #鏌ョ湅纾佺洏鐨勬儏鍐碉紝姝ゆ椂鍙戠幇宸茬粡娌℃湁浠讳綍鍒嗗尯
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x189fc246
Device Boot Start End Blocks Id System
[[email protected] ~]# mkfs.xfs -f /dev/sdb #鏍煎紡鍖栦负xfs鏂囦欢绯荤粺锛涚敱浜庝箣鍓嶅凡缁忔牸寮忓寲杩囦竴娆★紝鐜板湪鏍煎紡鍖栭渶瑕佸姞-f閫夐」寮哄埗鏍煎紡鍖?/span>
meta-data=/dev/sdb isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[[email protected] ~]# blkid /dev/sdb #浣跨敤blkid鍛戒护鏌ョ湅纾佺洏鐨勬枃浠剁郴缁?/span>
/dev/sdb: UUID="2e36a530-168e-47cf-8e0d-659aaa606840" TYPE="xfs"
[[email protected] ~]# df -h #鏌ョ湅鍒嗗尯鎯呭喌
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 44G 1.6G 43G 4% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.5M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 1014M 33M 982M 4% /home
/dev/sda1 1014M 135M 880M 14% /boot
tmpfs 378M 0 378M 0% /run/user/0
[[email protected] ~]# mount /dev/sdb /mnt/ #鐢ㄦ硶mount [閫夐」]<鐩樼><鎸傝浇鐐?gt;
[[email protected] ~]# df -h #鍙互鐪嬪埌鏈€鍚庝竴鍒楀凡缁忔垚鍔熸寕杞斤紝/mnt鎸傝浇鐐瑰ソ姣旀槸纾佺洏鐨勫叆鍙o紝娌℃湁鎸傝浇鐐瑰氨鏃犳硶鍦ㄧ鐩橀噷鍐欐暟鎹€?/span>
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 44G 1.6G 43G 4% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.5M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 1014M 33M 982M 4% /home
/dev/sda1 1014M 135M 880M 14% /boot
tmpfs 378M 0 378M 0% /run/user/0
/dev/sdb 10G 33M 10G 1% /mnt
濡備綍鍗歌浇鍛紵
[[email protected] mnt]# umount /dev/sdb #瀹冧細鎻愮ず鍗歌浇涓嶄簡锛岀洰鏍囨蹇欍€傚師鍥犳槸鎴戜滑姝e湪瀹冪鐩橀噷闈€?/span>
umount: /mnt: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
姝ゆ椂鏈変袱涓В鍐虫柟娉?/div>
1銆侀€€鍑烘寕杞界偣
[[email protected] ~]# umount /dev/sdb
2銆佸姞涓?l閫夐」
[[email protected] ~]# mount /dev/sdb /mnt/
[[email protected] ~]# cd /mnt/
[[email protected] mnt]# umount -l /dev/sdb
[[email protected] ~]# man mount #鏌ュ府鍔╋紝甯哥敤閫夐」鐨勬剰涔夈€?/span>
async/sync锛氱鐩樺拰鍐呭瓨鏄惁鍚屾锛岄粯璁sync涓嶅悓姝ワ紱
auto/noauto锛氬紑鏈鸿嚜鍔ㄦ寕杞?涓嶈嚜鍔ㄦ寕杞斤紱
default锛氭寜鐫€澶у鏁版案涔呮枃浠剁郴缁熺殑缂虹渷鍊艰缃寕杞藉畾涔夛紝鍖呭惈rw锛宻uid锛宒ev锛宔xec锛宎uto锛宯ouser锛宎sync绛?nbsp;
ro锛氭寜鍙鏉冮檺鎸傝浇
rw锛氭寜璇诲啓鏉冮檺鎸傝浇
exec/noexec锛氬厑璁?涓嶅厑璁稿彲鎵ц鏂囦欢鎵ц锛屽崈涓囦笉瑕佹妸鏍瑰垎鍖烘寕杞戒负noexec銆?/div>
user/nouser锛氬厑璁?涓嶅厑璁竢oot澶栧叾浠栫敤鎴锋寕杞藉垎鍖猴紝涓轰簡瀹夊叏鑰冭檻锛屼娇鐢╪ouser
suid/nosuid锛氬厑璁?涓嶅厑璁稿垎鍖烘湁suid灞炴€э紝涓€鑸缃畁osuid
usrquota锛氬惎鍔ㄤ娇鐢ㄨ€呯鐩橀厤棰濇ā寮忥紝鍙拡瀵圭敤鎴烽檺瀹氫粬浠殑浣跨敤棰濆害
grquota锛氬惎鍔ㄧ兢缁勭鐩橀厤棰濇ā寮?/div>
閲嶆柊鎸傝浇纾佺洏
[[email protected] ~]# mount -o remount,rw /dev/sdb /mnt/
[[email protected] ~]# vim /etc/fstab #濡傛灉鎯宠寮€鏈鸿嚜鍔ㄦ寕杞斤紝灏遍渶瑕佸湪/etc/fstab閰嶇疆鏂囦欢涓婂啓
#
# /etc/fstab
# Created by anaconda on Tue May 15 23:23:48 2018
#
# Accessible filesystems, by reference, are maintained under 鈥?dev/disk鈥?/div>
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=0a548611-1d43-47bd-af8b-73c62b4efc9b / xfs defaults 0 0
UUID=a20b1f54-71d4-455b-a1e3-5d5e04310479 /boot xfs defaults 0 0
UUID=50bcd687-ca95-491c-b987-346bb77a4364 /home xfs defaults 0 0
UUID=51efdc5d-8c12-4299-a7e9-d963e8d5361a swap swap defaults 0 0
/dev/sdb /mnt xfs defaults 0 0
#dev/sdb锛氱洰褰曞拰UUID涓€鏍风殑浣滅敤
#/mnt锛氭寕杞界偣
#xfs锛氭枃浠剁郴缁熺被鍨?/strong>
#defaults锛氶粯璁ら€夐」
#绗竴涓?锛氭槸鍚﹀浠姐€?浠h〃涓嶅浠斤紱
#绗簩涓?锛氬紑鏈轰笉闇€瑕佹娴嬬鐩樹负0锛岄渶瑕佹娴嬬鐩橈紝鏍瑰垎鍖轰负1锛屽叾瀹冧负2
[[email protected] ~]# blkid #/dev/sdb鍜孶UID鎸傝浇鐨勪綔鐢ㄦ槸涓€鏍风殑銆備竴鏍峰彲浠ュ啓鍏?etc/fstab閰嶇疆鏂囦欢鐨勭涓€鍒楀幓銆?/span>
/dev/sdb: UUID="2e36a530-168e-47cf-8e0d-659aaa606840" TYPE="xfs"
/dev/sda1: UUID="a20b1f54-71d4-455b-a1e3-5d5e04310479" TYPE="xfs"
/dev/sda2: UUID="0a548611-1d43-47bd-af8b-73c62b4efc9b" TYPE="xfs"
/dev/sda3: UUID="51efdc5d-8c12-4299-a7e9-d963e8d5361a" TYPE="swap"
/dev/sda5: UUID="50bcd687-ca95-491c-b987-346bb77a4364" TYPE="xfs"
/dev/sr0: UUID="2017-09-06-10-51-00-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
[[email protected] ~]# mount UUID="2e36a530-168e-47cf-8e0d-659aaa606840" /mnt/
[[email protected] ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 xfs 44G 1.6G 43G 4% /
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 8.5M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 xfs 1014M 33M 982M 4% /home
/dev/sda1 xfs 1014M 135M 880M 14% /boot
tmpfs tmpfs 378M 0 378M 0% /run/user/0
/dev/sdb xfs 10G 33M 10G 1% /mnt
以上是关于Linux纾佺洏鎸傝浇的主要内容,如果未能解决你的问题,请参考以下文章