Linux 下硬盘挂载方法

395 阅读2分钟

 输入命令:df -h后发现:

文件系统            容量  已用 可用 已用% 挂载点
/dev/sda1             895G  731G  119G  87% /
none                  3.9G  240K  3.9G   1% /dev
none                  3.9G  1.1M  3.9G   1% /dev/shm
none                  3.9G  452K  3.9G   1% /var/run
none                  3.9G     0  3.9G   0% /var/lock
none                  3.9G     0  3.9G   0% /lib/init/rw

大概有1T 的空间,但是我的电脑可是有2T+125G固态硬盘呢,还有没用到的,于是再次执行:sudo fidisk -l

发现:

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006471f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1      118649   953044992   83  Linux
/dev/sda2          118649      121602    23714817    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          118649      121602    23714816   82  Linux swap / Solaris

Disk /dev/sdc: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 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: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table


sudo mount -t ext4 /dev/sdb1 /home/chaihuasong/1T/

df -h:

文件系统            容量  已用 可用 已用% 挂载点
/dev/sda1             895G  731G  119G  87% /
none                  3.9G  244K  3.9G   1% /dev
none                  3.9G  1.1M  3.9G   1% /dev/shm
none                  3.9G  452K  3.9G   1% /var/run
none                  3.9G     0  3.9G   0% /var/lock
none                  3.9G     0  3.9G   0% /lib/init/rw
/dev/sdb1             917G  200M  871G   1% /home/chaihuasong/1T

最后一步就是设定开机自动挂载,

如下:

输入命令:sudo blkid

$ sudo blkid
/dev/sdb1: UUID="52313c6f-a18d-4088-baf8-f44b647c8947" TYPE="ext3" 
/dev/sda1: UUID="9f6f6ae7-c446-4b61-a61f-c6b8162bc591" TYPE="ext4" 
/dev/sda5: UUID="47685248-5732-4766-9d3d-b4b4602472c4" TYPE="swap" 
/dev/sdc1: UUID="7d1eb697-8daa-4f29-bafa-e65a70cdab35" TYPE="ext3" 
/dev/sdc3: UUID="7d1eb697-8daa-4f29-bafa-e65a70cdab35" TYPE="ext3"

最后别忘记改一下权限:

sudo chmod 777 /home/chaihuasong/1T
sudo chmod 777 /home/chaihuasong/SSD

OK,大功告成,正在重启电脑。。。

发现如下配置不需要:

sudo vim /etc/fstab

加入如下两行:

UUID=52313c6f-a18d-4088-baf8-f44b647c8947 /home/chaihuasong/1T            ext4    defaults        1       2
UUID=7d1eb697-8daa-4f29-bafa-e65a70cdab35 /home/chaihuasong/SSD            swap    sw              0       0

特地更新一下。

\