掛載硬盤(pán)對(duì)于linux系統(tǒng)來(lái)講是一個(gè)比較常見(jiàn)的問(wèn)題了,下面我們來(lái)看看linux中掛載新硬盤(pán)到目錄,并開(kāi)機(jī)自動(dòng)掛載例子緊,
今天,在整理圖片時(shí),發(fā)現(xiàn)根目錄硬盤(pán)空間已經(jīng)所剩無(wú)幾了,而網(wǎng)站和所有相關(guān)文件主要放置在根下data目錄(/data)里,但/home下是有空間,而又不想把文件放到/home下面去,只有再加一個(gè)新硬盤(pán),對(duì)以后/data目錄的文件管理也比較好。
那么就先關(guān)掉主機(jī),再加上新硬盤(pán)(其它電腦使用過(guò)的500G硬盤(pán)),插上后再啟動(dòng)電腦。
接下來(lái),就開(kāi)始工作了:
1. 查看硬盤(pán)信息:
feigo@figo:~$ sudo df -h
文件系統(tǒng) 容量 已用 可用 已用% 掛載點(diǎn)
rootfs 102G 92G 4.7G 96% /
udev 10M 0 10M 0% /dev
tmpfs 799M 1.8M 798M 1% /run
/dev/disk/by-uuid/3640f24a-4870-42e2-ae07-109cb9c35164 102G 92G 4.7G 96% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 4.6G 224K 4.6G 1% /run/shm
/dev/sda7 92M 26M 62M 30% /boot
/dev/sda9 201G 23G 169G 12% /home
feigo@figo:~$ sudo fdisk -l
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0x3f1e271a
Device Boot Start End Blocks Id System
/dev/sdb1 63 102414374 51207156 7 HPFS/NTFS/exFAT
/dev/sdb2 102414375 976768064 437176845 f W95 Ext'd (LBA)
/dev/sdb5 102414438 409625369 153605466 b W95 FAT32
/dev/sdb6 409625433 716836364 153605466 b W95 FAT32
/dev/sdb7 716836428 976768064 129965818+ 7 HPFS/NTFS/exFAT
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0xc35aebd4
Device Boot Start End Blocks Id System
/dev/sda1 * 63 104872319 52436128+ 7 HPFS/NTFS/exFAT
/dev/sda2 104872381 976771071 435949345+ f W95 Ext'd (LBA)
/dev/sda5 104872383 231962534 63545076 7 HPFS/NTFS/exFAT
/dev/sda6 231962598 300929579 34483491 b W95 FAT32
/dev/sda7 300931072 301125631 97280 83 Linux
/dev/sda8 301127680 517726207 108299264 83 Linux
/dev/sda9 517728256 945461247 213866496 83 Linux
/dev/sda10 945463296 976771071 15653888 82 Linux swap / Solaris
我們可以看到有兩個(gè)硬盤(pán),sda和sdb,其中sda是目前使用中的硬盤(pán),sdb是新加上去的硬盤(pán)。
2. 針對(duì)sdb創(chuàng)建新硬盤(pán)分區(qū):