1. 程式人生 > >linux下新增邏輯分割槽並掛載(手動和自動方式)

linux下新增邏輯分割槽並掛載(手動和自動方式)

一、檢視新磁碟
[[email protected] Desktop]# fdisk -cul /dev/sdc

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x00000000
二新增邏輯分割槽
[
[email protected]
Desktop]# fdisk -cu /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x740491c5.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.


Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)


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)
e---------------〉選擇擴充套件分割槽
Partition number (1-4): 2
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): 10G
Value out of range.
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +10G


Command (m for help): N
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
L-----------------〉選擇邏輯分割槽
First sector (4096-20973567, default 4096): 
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-20973567, default 20973567): +5G


Command (m for help): N
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
L-------------------〉選擇邏輯分割槽
First sector (10491904-20973567, default 10491904): 
Using default value 10491904
Last sector, +sectors or +size{K,M,G} (10491904-20973567, default 20973567): +5G
Value out of range.
Last sector, +sectors or +size{K,M,G} (10491904-20973567, default 20973567): 
Using default value 20973567


Command (m for help): P--------------->列印分割槽列表


Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x740491c5


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc2            2048    20973567    10485760    5  Extended
/dev/sdc5            4096    10489855     5242880   83  Linux
/dev/sdc6        10491904    20973566     5240831+  83  Linux
自動命名邏輯分割槽為:sdc5 sdc6
Command (m for help): w------------------>儲存退出
The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.
[
[email protected]
Desktop]# part
parted     partprobe  partx      
[[email protected] Desktop]# partx -a /dev/sdc
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 5
BLKPG: Device or resource busy
error adding partition 6
三、檢視新分割槽
[[email protected]
Desktop]# fdisk -cu /dev/sdc


Command (m for help): p


Disk /dev/sdc: 21.5 GB, 21474836480 bytes
139 heads, 49 sectors/track, 6158 cylinders, total 41943040 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: 0x740491c5


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc2            2048    20973567    10485760    5  Extended
/dev/sdc5            4096    10489855     5242880   83  Linux
/dev/sdc6        10491904    20973566     5240831+  83  Linux


Command (m for help): q
四、格式化分割槽
1sdc5
[[email protected] Desktop]# mkfs.ext4 /dev/sdc5
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
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736


Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
2sdc6
[[email protected] Desktop]# mkfs.ext4 /dev/sdc6
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
327680 inodes, 1310207 blocks
65510 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736


Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
五、新建掛載目錄
[[email protected] Desktop]# cd /mnt/
[[email protected] mnt]# ls
hgfs
[[email protected] mnt]# mkdir sdc{5,6}
[[email protected] mnt]# ls
hgfs  sdc5  sdc6
[[email protected] mnt]# pwd
/mnt
六、分別自動掛載sdc5、sdc6到/mnt/sdc5 、 /mnt/sdc6
[[email protected] mnt]# mount /dev/sdc5 /mnt/sdc5
[[email protected] mnt]# mount /dev/sdc6 /mnt/sdc6
七、查可掛載是否成功
[[email protected] mnt]# mount
/dev/mapper/vol0-root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vol0-home on /home type ext4 (rw)
/dev/sdb5 on /tmp/sdb5 type ext4 (rw)
/dev/sdb6 on /tmp/sdb6 type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sdc5 on /mnt/sdc5 type ext4 (rw)
/dev/sdc6 on /mnt/sdc6 type ext4 (rw)
九、解除安裝sdc5 sdc6
[[email protected] mnt]# umount /dev/sdc5
[[email protected] mnt]# umount /dev/sdc6
[[email protected] mnt]# mount
/dev/mapper/vol0-root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vol0-home on /home type ext4 (rw)
/dev/sdb5 on /tmp/sdb5 type ext4 (rw)
/dev/sdb6 on /tmp/sdb6 type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
十、手工掛載
1、檢視sdb5的UUID
[[email protected] mnt]#blkid /dev/sdb5
2、手工掛載sdb5、sdb6
[[email protected] mnt]# cd /etc
[[email protected] etc]# vi fstab


#
# /etc/fstab
# Created by anaconda on Fri Apr 11 00:49:26 2014
#
# 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
#
/dev/mapper/vol0-root   /                       ext4    defaults        1 1
UUID=9353a628-e49f-4675-abf4-b0fe76b38fbc /boot                   ext4    defaults        1 2
/dev/mapper/vol0-home   /home                   ext4    defaults        1 2
UUID=f3d4a81c-f2d6-48d8-be1a-35647cd74615 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=dfa6e086-e5be-4856-9e8d-9565d52b82e6 /mnt/sdc5 ext4 defaults 0 0
/dev/sdc6/mnt/sdc6ext4defaults0 0
方式有通過分割槽名和UUID
十一、檢視掛載結果
[[email protected] etc]# mount -a------------------〉重新整理mount 
[[email protected] etc]# mount
/dev/mapper/vol0-root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vol0-home on /home type ext4 (rw)
/dev/sdb5 on /tmp/sdb5 type ext4 (rw)
/dev/sdb6 on /tmp/sdb6 type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sdc5 on /mnt/sdc5 type ext4 (rw)
/dev/sdc6 on /mnt/sdc6 type ext4 (rw)
[[email protected] etc]# 

相關推薦

linux新增邏輯分割槽掛載手動自動方式

一、檢視新磁碟 [[email protected] Desktop]# fdisk -cul /dev/sdc Disk /dev/sdc: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders, total

linux添加邏輯分區掛載手動自動方式

mount -a 自動掛載 tom rpc nosuid contains fst gid 成功 一、查看新磁盤[root@desktop61 Desktop]# fdisk -cul /dev/sdcDisk /dev/sdc: 21.5 GB, 21474836480

linux檢視磁碟分割槽&掛載

1.檢視磁碟分割槽列表 fdisk -l 可以看到: 磁碟 /dev/vdb:214.7 GB, 214748364800 位元組,419430400 個扇區 Units = 扇區 of 1 * 512 = 512 bytes 扇區大小(邏輯/物理):512 位元組 / 512 位元組 I/O

albert1017 Linux壓縮某個文件夾文件夾打包

-bash 舉例 AR 當前目錄 linux zip 格式 時間 not unzip tar -zcvf /home/xahot.tar.gz /xahottar -zcvf 打包後生成的文件名全路徑 要打包的目錄例子:把/xahot文件夾打包後生成一個/home/xaho

kail linux nc工具的基本使用安全牛視頻

效果 設計 思路 all 可靠 加密方法 了解 一個 網站 一、簡介 nc是netcat的簡寫,有著網絡界的瑞士×××美譽。因為它短小精悍、功能實用,被設計為一個簡單、可靠的網絡工具。 nc 常用的命令有兩個: 1、-v 輸出詳細的交互或者出錯信息 2、-n 如果後面是ip

linux Redis 5.0主從複製一主二從的搭建

文件結構如下:   一、環境說明: 作用 IP地址 埠 作業系統版本 安裝目錄 主庫 172.16.10.80 6379 Redhat 6.7

windows使用FFmpeg生成YUV視訊檔案播放通過命令的方式

一、YUV的定義   YUV是一種顏色編碼方法。它跟我們常見的RGB格式區分開來,常使用在各個視訊處理元件中。其中"Y"代表明亮度,"U"和"V"代表其色度。視訊播放器把市面上流行的MP4等格式的視訊檔案解碼出來,得到的一般會是YUV格式的資料,然後得進行轉碼(比如通過op

LinuxUDP的連線程式示例阻塞、非阻塞

由於前面已有介紹,關於函式就不介紹了 /*server.c_非阻塞式*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h>

複習之spring基礎——Spring 的事務管理—配置AOP事務XML註解方式

事務 事務邏輯上的一組操作,組成這組操作的各個邏輯單元,要麼一起成功,要麼一起失敗 事務的特性 原子性 :強調事務的不可分割. 一致性 :事務的執行的前後資料的完整性保持一致. 隔離性 :一個事務執行的過程中,不應該受到其他事務的干擾. 永續性 :事務一旦結束

Altium Designer 佈線快捷鍵手動自動佈線

Altium Designer 6系統為設計者提供了個功能強大、操作方便,而且布通率極高的自動 佈線器,但在實際設計中,仍然會有不盡人意的地方,需要設計者去手工放置或調整PCB 上的佈線,以便獲得更為完善的設計效果。還有一些設計者出於個人喜好,習慣於對整個 PCB進行全部的手工佈線,因此,提供了很方

java服務端Log4j日誌記錄檔案資料庫方式

要在自己的程式中使用Log4j,首先需要將commons-logging.jar和logging-log4j-1.2.9.jar匯入到構建路徑中。 然後再將log4j.properties放到src根目錄下。 1、不使用配置,單純用程式記錄日誌的方式 package t

用vlc搭建簡單流媒體伺服器UDPTCP方式

這段時間用到了流媒體資料傳輸的TCP和UDP方式,感覺vlc可以做這方面的demo,這裡總結下,也方便我以後查閱。 簡介 VLC不僅僅是個播放器,也可以作為流媒體伺服器使用。這個網上有相關的資料,我就不多說了。 宣告下本文用的VLC版本:2.0.3 用VLC搭建基於UDP的流媒體伺服器 流媒體伺服器大

用vlc搭建簡單流媒體伺服器UDPTCP方式-轉 rtsp很慢才能顯示

這段時間用到了流媒體資料傳輸的TCP和UDP方式,感覺vlc可以做這方面的demo,這裡總結下,也方便我以後查閱。 簡介 VLC不僅僅是個播放器,也可以作為流媒體伺服器使用。這個網上有相關的資料,我就不多說了。 宣告下本文用的VLC版本:2.0.3 用VLC搭建基於UDP的流媒體伺服器 流媒體伺服

ubuntu 16.04安裝redis的兩種方式apt編譯方式解除安裝

  保證網路暢通,選定好下載工作路徑,執行以下命令下載redis-3.2.6: sudo wget http://download.redis.io/releases/redis-3.2.6.ta

linux新增大於2T硬碟,分割槽掛載

環境:Ubuntu 16 硬碟:8T機械硬碟 在分割槽以前,介紹一下步驟: Create a disklabel (partitioning) on disk.建立磁碟標籤 Create a partition of the appropriate s

linux 建立擴充套件分割槽以及邏輯分割槽以及掛載分割槽

這裡對Linux建立擴充套件分割槽和邏輯分割槽,以及格式化分割槽和掛載分割槽進行一個詳細的介紹,希望能幫助到你們! 1.Linux 建立擴充套件分割槽以及邏輯分割槽 [[email protected] ~]# fdisk /dev/sdb

Linux給磁碟分割槽、格式化、掛載

u 一個新磁碟要經過分割槽、格式化、掛載以後才可以給linux讀寫檔案,如果磁碟已經分割槽且格式化過,那隻要掛載即可。 命令彙總: fdisk -l # 檢視所有磁碟裝置 fdisk 磁碟裝置號 # 進入fdisk互動式分割槽介面,為裝置進行分割槽 p

linux使用邏輯LVM實現多塊硬碟的整與可持續擴充

[[email protected] ~]# pvcreate /dev/sdb1 /dev/sdc1                                            ####使用pvcreate把兩個分割槽加入到新pv裡,多個分割槽的時候也這麼寫只要分割槽間用空格格開就

Linux新增使用者賦予root許可權

linux下新增使用者並賦予root許可權 1、用adduser命令新增一個普通使用者,命令如下: #adduser username 2、賦予root許可權 方法一:修改 /etc/sudoers 檔案,找到下面一行,把前面的註釋(#)去掉

Linux————Linux批量建立使用者設定密碼shell指令碼

在這裡分為兩種情況 1.有規則給定使用者名稱 2.給定無規則使用者名稱 3.刪除 一:以下是建立給定使用者名稱: 首先得給出給定使用者名稱,並逐個建立 for user in {u1,u2,u3,u