现在的位置: 首页 > 综合 > 正文

根据UUID挂载简单挂载分区

2017年10月20日 ⁄ 综合 ⁄ 共 2296字 ⁄ 字号 评论关闭

首先新挂一个盘(物理),我的盘符为sdc
[root@ralbatr ~]# fdisk /dev/sdc (对应的新盘)
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 
Command (m for help): n  (新建一个分区)
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (133-1044, default 133): 
Using default value 133
Last cylinder, +cylinders or +size{K,M,G} (133-1044, default 1044): +1G  (指定大小)
 
Command (m for help): p  (打印分区列表)
 
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x859241b6
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         132     1060258+  83  Linux
/dev/sdc2             133         264     1060290   83  Linux
Command (m for help): w  (保存)
我在fstab中挂载sdc1  
[root@ralbatr ~]# ll /dev/disk/by-uuid/
总用量 0
lrwxrwxrwx. 1 root root 10  4月  7 15:22 36507746-6055-41b3-90e1-ea50953d0353 -> ../../sda3
lrwxrwxrwx. 1 root root 10  4月  7 15:22 54f1f136-b335-4b48-bf95-f247c90b274b -> ../../dm-1
lrwxrwxrwx. 1 root root 10  4月  7 15:24 586f891d-1611-40cc-ae5a-e0409f104afc -> ../../sdc1
lrwxrwxrwx. 1 root root 10  4月  7 15:22 68230da0-48b4-4f1f-b91b-d2f396f81d0a -> ../../sda2
lrwxrwxrwx. 1 root root 10  4月  7 15:22 6fda64da-313e-428e-a1ce-610d44e7fe66 -> ../../dm-0
lrwxrwxrwx. 1 root root 10  4月  7 15:22 d6006e8a-58d5-45bf-99ee-442469bae90c -> ../../sda1
[root@syd168 ~]# ll /dev/disk/by-uuid/|grep sdc1
lrwxrwxrwx. 1 root root 10  4月  7 15:24 586f891d-1611-40cc-ae5a-e0409f104afc -> ../../sdc1
[root@ralbatr ~]# ll /dev/disk/by-uuid/|grep sdc1>>/etc/fstab 
[root@ralbatr ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Jan  6 15:45:12 2011
#
# 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
#
UUID=36507746-6055-41b3-90e1-ea50953d0353 /                       ext4    defaults        1 1
UUID=d6006e8a-58d5-45bf-99ee-442469bae90c /boot                   ext4    defaults        1 2
UUID=68230da0-48b4-4f1f-b91b-d2f396f81d0a swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
UUID=586f891d-1611-40cc-ae5a-e0409f104afc /mnt  ext3    defaults        0 0 
[root@ralbatr ~]# mount -a  (重新挂载fatab)

抱歉!评论已关闭.