linux下掛載新硬碟和分割槽的步驟
今天和大家分享一下在linux下掛載新硬碟的步驟。
演示的環境基於centos
[root@localhost etc]# uname -a
Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost etc]# cat system-release
CentOS release 6.2 (Final)
[root@localhost etc]#
先掛載了一個3G的硬碟檢視磁碟空間的情況
[root@localhost etc]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0x0004daae
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 4998 39832576 83 Linux
/dev/sda3 4998 5222 1802240 82 Linux swap / Solaris
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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/sdb doesn't contain a valid partition table
劃分磁碟分割槽,分為4個主分割槽,最後寫入磁碟。
[root@localhost etc]# fdisk /dev/sdb
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 4
First cylinder (1-391, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-391, default 391): 100
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (101-391, default 101): 101
Last cylinder, +cylinders or +size{K,M,G} (101-391, default 391): 200
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (201-391, default 201): 201
Last cylinder, +cylinders or +size{K,M,G} (201-391, default 391): 300
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 1
First cylinder (301-391, default 301): 301
Last cylinder, +cylinders or +size{K,M,G} (301-391, default 391): 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost etc]# fdisk -l
再次檢視分割槽情況,
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0xe5f51a7b
Device Boot Start End Blocks Id System
/dev/sdb1 301 391 730957+ 83 Linux
/dev/sdb2 101 200 803250 83 Linux
/dev/sdb3 201 300 803250 83 Linux
/dev/sdb4 1 100 803218+ 83 Linux
Partition table entries are not in disk order
我就格式化第一個分割槽,採用檔案系統ext3.
[root@localhost etc]# mkfs -t ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
45696 inodes, 182739 blocks
9136 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=188743680
6 block groups
32768 blocks per group, 32768 fragments per group
7616 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
建立一個臨時目錄,然後把分割槽掛載到這個目錄下。
[root@localhost /]# mkdir test
[root@localhost /]# mount /dev/sdb1 /test
掛載後檢視磁碟情況,就可以看到分割槽就在那了。
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 38G 32G 4.3G 89% /
tmpfs 980M 288K 980M 1% /dev/shm
/dev/sda1 291M 32M 244M 12% /boot
/dev/sdb1 703M 17M 651M 3% /test
配置開機啟動項
vi /etc/fstab
LABEL=SWAP-sda2 swap swap defaults 0 0
加入如下
/dev/sdb1 /test ext3 defaults 1 1
~
5. 第5列為dump選項,設定是否讓備份程式dump備份檔案系統,0為忽略,1為備份。
6. 第6列為fsck選項,告訴fsck程式以什麼順序檢查檔案系統,0為忽略。
演示的環境基於centos
[root@localhost etc]# uname -a
Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost etc]# cat system-release
CentOS release 6.2 (Final)
[root@localhost etc]#
先掛載了一個3G的硬碟檢視磁碟空間的情況
[root@localhost etc]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0x0004daae
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 4998 39832576 83 Linux
/dev/sda3 4998 5222 1802240 82 Linux swap / Solaris
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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/sdb doesn't contain a valid partition table
劃分磁碟分割槽,分為4個主分割槽,最後寫入磁碟。
[root@localhost etc]# fdisk /dev/sdb
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 4
First cylinder (1-391, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-391, default 391): 100
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (101-391, default 101): 101
Last cylinder, +cylinders or +size{K,M,G} (101-391, default 391): 200
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (201-391, default 201): 201
Last cylinder, +cylinders or +size{K,M,G} (201-391, default 391): 300
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 1
First cylinder (301-391, default 301): 301
Last cylinder, +cylinders or +size{K,M,G} (301-391, default 391): 391
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost etc]# fdisk -l
再次檢視分割槽情況,
Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0xe5f51a7b
Device Boot Start End Blocks Id System
/dev/sdb1 301 391 730957+ 83 Linux
/dev/sdb2 101 200 803250 83 Linux
/dev/sdb3 201 300 803250 83 Linux
/dev/sdb4 1 100 803218+ 83 Linux
Partition table entries are not in disk order
我就格式化第一個分割槽,採用檔案系統ext3.
[root@localhost etc]# mkfs -t ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
45696 inodes, 182739 blocks
9136 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=188743680
6 block groups
32768 blocks per group, 32768 fragments per group
7616 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
建立一個臨時目錄,然後把分割槽掛載到這個目錄下。
[root@localhost /]# mkdir test
[root@localhost /]# mount /dev/sdb1 /test
掛載後檢視磁碟情況,就可以看到分割槽就在那了。
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 38G 32G 4.3G 89% /
tmpfs 980M 288K 980M 1% /dev/shm
/dev/sda1 291M 32M 244M 12% /boot
/dev/sdb1 703M 17M 651M 3% /test
配置開機啟動項
vi /etc/fstab
LABEL=SWAP-sda2 swap swap defaults 0 0
加入如下
/dev/sdb1 /test ext3 defaults 1 1
~
5. 第5列為dump選項,設定是否讓備份程式dump備份檔案系統,0為忽略,1為備份。
6. 第6列為fsck選項,告訴fsck程式以什麼順序檢查檔案系統,0為忽略。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1349353/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 9.2 Linux硬碟分割槽和掛載Linux硬碟
- linux掛載新硬碟並進行分割槽格式化Linux硬碟
- Linux 磁碟分割槽和掛載Linux
- Linux硬碟分割槽及開機自動掛載Linux硬碟
- Linux 基礎教程 33-硬碟分割槽及掛載Linux硬碟
- linux硬碟分割槽Linux硬碟
- Linux 分割槽擴容(根分割槽擴容,SWAP 分割槽擴容,掛載新分割槽為目錄)Linux
- linux 新增磁碟 分割槽掛載Linux
- linux 磁碟分割槽掛載-fdiskLinux
- Liunx新增新硬碟和分割槽方法硬碟
- win10無損分割槽的步驟_win10如何對硬碟無損分割槽Win10硬碟
- 為linux新增一塊新硬碟並分割槽Linux硬碟
- linux之硬碟分割槽管理Linux硬碟
- linux fdisk 分割槽、格式化、掛載!Linux
- Linux磁碟分割槽及自動掛載Linux
- Linux硬碟掛載與磁碟分割槽基礎(二)(物理卷、卷組、邏輯卷)Linux硬碟
- 硬碟空間的管理和分割槽硬碟
- linux新增新磁碟和建立分割槽Linux
- Linux硬碟分割槽生效命令partprobeLinux硬碟
- 『學了就忘』Linux基礎命令 — 39、掛載U盤和掛載NTFS分割槽Linux
- Linux磁碟分割槽、掛載、檢視檔案大小Linux
- Linux下的磁碟分割槽和邏輯卷Linux
- win10新增硬碟分割槽怎麼操作 win10硬碟如何增加新分割槽Win10硬碟
- 2018年第43周-Linux下使用gpt給硬碟分割槽LinuxGPT硬碟
- ubuntu環境下掛載新硬碟(轉載)Ubuntu硬碟
- SSD固態硬碟要分割槽嗎?SSD固態硬碟分割槽與不分割槽的效能對比硬碟
- parted和fdisk——兩種磁碟分割槽並掛載的方法
- ubuntu 掛載新硬碟Ubuntu硬碟
- Linux下partprobe命令的使用, 不重啟識別新分割槽Linux
- Linux下進行格式化行動硬碟(U盤)以及分割槽Linux硬碟
- linux下玩轉磁碟管理與掛載硬碟Linux硬碟
- 電腦硬碟分割槽要注意什麼,刪除硬碟分割槽的注意事項硬碟
- DiskGenius分割槽行動硬碟硬碟
- Liunx 磁碟分割槽與檔案掛載
- 3tb硬碟怎麼分割槽_利用DiskGenius給3tb硬碟分割槽的方法硬碟
- Linux下磁碟分割槽工具cfdisk的使用Linux
- ghost win10如何分割槽硬碟_ghost win10怎麼分割槽硬碟Win10硬碟
- Linux分割槽方案、分割槽建議Linux
- [LINUX] Arch Linux 硬碟拷貝式裝系統+新增 home 分割槽Linux硬碟