linux分区,挂盘,LVM

1. 虚拟机可以添加sisc硬盘,添加了要重启虚拟机才能生效

重启后用fdisk -l可以查看到新添的盘,/dev/sdb是新加的第二块硬盘

[[email protected] ~]# fdisk -l
Disk /dev/sdb: 1073 MB, 1073741824 bytes 
255 heads, 63 sectors/track, 130 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 /dev/sda: 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: 0x00096eec
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26          91      524288   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3              91        1045     7658496   83  Linux

2. 磁盘分区

命令fdisk /dev/sdb

[[email protected]~]# fdisk /dev/sdb

Device containsneither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a newDOS disklabel with disk identifier 0x29a761e1.

Changes willremain in memory only, until you decide to write them.

After that, ofcourse, the previous content won‘t be recoverable.

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

WARNING:DOS-compatible mode is deprecated. It‘s strongly recommended to

switch off the mode (command ‘c‘) andchange display units to

sectors (command ‘u‘).

Command (m forhelp):

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 forhelp): p

Disk /dev/sdb:106 MB, 106954752 bytes

64 heads, 32sectors/track, 102 cylinders

Units = cylindersof 2048 * 512 = 1048576 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Disk identifier:0x29a761e1

Device Boot      Start         End      Blocks  Id  System

Command (m forhelp): n

Command action

e  extended

p  primary partition (1-4)

p

Partition number(1-4): 1

First cylinder(1-102, default 1):

Using defaultvalue 1

Last cylinder,+cylinders or +size{K,M,G} (1-102, default 102): +10m

Unsupportedsuffix: ‘m‘.

Supported: 10^N:KB (KiloByte), MB (MegaByte), GB (GigaByte)

2^N: K  (KibiByte), M (MebiByte), G  (GibiByte)

Last cylinder,+cylinders or +size{K,M,G} (1-102, default 102): +10M

Command (m forhelp): p

Disk /dev/sdb:106 MB, 106954752 bytes

64 heads, 32sectors/track, 102 cylinders

Units =cylinders of 2048 * 512 = 1048576 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Disk identifier:0x29a761e1

Device Boot      Start         End     Blocks   Id System

/dev/sdb1               1          11       11248  83  Linux

l查看分区类型

Command (m forhelp): l

0 Empty           24  NEC DOS         81 Minix / old Lin bf  Solaris

1 FAT12           39  Plan 9          82  Linux swap /So c1  DRDOS/sec (FAT-

2  XENIXroot      3c  PartitionMagic  83  Linux           c4 DRDOS/sec (FAT-

3  XENIXusr       40  Venix 80286     84 OS/2 hidden C:  c6  DRDOS/sec (FAT-

4  FAT16<32M      41  PPC PReP Boot   85 Linux extended  c7  Syrinx

5 Extended        42  SFS             86 NTFS volume set da  Non-FSdata

6 FAT16           4d  QNX4.x          87 NTFS volume set db  CP/M / CTOS /.

7 HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility

8 AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df BootIt

9  AIXbootable    50  OnTrack DM      93 Amoeba          e1  DOS access

#如果要修改分区类型,用t

Command (m forhelp): t

Partition number(1-8): 8

Hex code (type Lto list codes): 8e

Changed systemtype of partition 8 to 8e (Linux LVM)

#然后就可以看到Id变成了8e,即现在是lVM类型的分区了

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  8e  Linux LVM

3. 格式化分区

[[email protected]~]# mkfs.ext4 -b 4096 -i 1024 /dev/sdb1 
#格式化指定文件系统,inode和block,实际是默认的,不用指定
[[email protected]~]#mkfs.ext4 -T largerfile /dev/sdb1

-t: 文件系统

-T 快速格式化

4. 挂载

[[email protected]~]# mount /dev/sdb1 /mnt   

问题排错:如果出现如下错误:
[[email protected]~]# mount /dev/sdb1 /mnt  #未格式化,无法挂载
mount: you mustspecify the filesystem type

5. 查看挂载结果

df -hT

时间: 2024-08-29 19:03:18

linux分区,挂盘,LVM的相关文章

Linux系列之fdisk 分区挂盘

2019/3/28 星期四Linux系列之fdisk 分区挂盘 [root@hadoop04-184 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 47G 8.3G 39G 18% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.

Linux磁盘分区与LVM详解

内容大纲: 一.磁盘分区是怎样表示的? 二.Linux磁盘分区与文件系统类命令 三.LinuxLVM逻辑卷管理 四.磁盘分区相关命令操作演示 五.磁盘分区及LVM操作演示 一.磁盘分区是怎样表示的? IDE磁盘的设备文件采用/dev/hdx 来命名,分区则采用/dev/hdxy来命名,其中想表示磁盘(a是第一块磁盘,b是第二块磁盘,以此类推),与代表分区的号码(由1开始,1,2,3,以此类推) SCSI设备和分区采用/dev/sdx和/dev/sdxy来命名(x和y的命名规则与IED磁盘命名规则

Linux下对lvm逻辑卷分区大小的调整(针对xfs和ext4不同文件系统)

当我们在安装系统的时候,由于没有合理分配分区空间,在后续维护过程中,发现有些分区空间不够使用,而有的分区空间却有很多剩余空间.如果这些分区在装系统的时候使用了lvm(前提是这些分区要是lvm逻辑卷分区),那么就可以轻松进行扩容或缩容!不同文件系统类型所对应的创建.检查.调整命令不同,下面就针对xfs和ext2/3/4文件系统的lvm分区空间的扩容和缩容的操作做一记录:-----------------------------------------------------------------

1.4 Linux下对lvm逻辑卷分区大小的调整(针对xfs和ext4不同文件系统)

当我们在安装系统的时候,由于没有合理分配分区空间,在后续维护过程中,发现有些分区空间不够使用,而有的分区空间却有很多剩余空间.如果这些分区在装系统的时候使用了lvm(前提是这些分区要是lvm逻辑卷分区),那么就可以轻松进行扩容或缩容!不同文件系统类型所对应的创建.检查.调整命令不同,下面就针对xfs和ext2/3/4文件系统的lvm分区空间的扩容和缩容的操作做一记录: ----------------------------------------------------------------

Linux中的LVM(逻辑卷管理)

一.创建逻辑卷的步骤:fdisk 工具将磁盘转换为linux分区pvcreate命令将linux分区转换成物理卷(PV):vgcreate命令将创建好的物理卷处理成卷组(VG):lvcreate命令将卷组分成若干个逻辑卷(LV):对逻辑卷进行格式化,挂载,动态调整逻辑卷的大小,并且该操作不会影响逻辑卷(Lv)上的数据. 物理卷(PV)创建及管理具体操作步骤:先查看linux分区,将未使用空间转换为物理卷(先使用fdisk建立普通分区) # fdisk -l /dev/sdb   #查看linux

linux分区和目录相关知识

Filesystem:一个软件,内核中实现 Windows:ntfs,FAT32 Linux:VFS(Virtual File System) /:根目录 /bin,/sbin:二进制程序,操作系统自身运行就需要用到的程序 /usr/bin,/usr/sbin:二进制程序,基于的系统工具 /usr/local/bin,/usr/local/sbin:第三方程序 /lib:库文件 /usr/lib /usr/local/lib /etc:配置文件 /tmp:临时文件夹 /var log mail

linux 分区 物理卷 逻辑卷

今天我们主要说说分区.格式化.SWAP.LVM.软件RAID的创建哈~ 格式化 查看当前分区:fdisk   -l 这个命令我们以前是讲过的,我现在问下,ID那项是什么意思? 83 是代表EXT2和EXT3 82 是代表SWAP分区 硬盘结构我们就不讲了,相信大家都有基础.我们就直接进入操作 LINUX分区使用的工具是FDISK 对系统的第一个硬盘分区#fdisk   /dev/sda 如果是对第二个硬盘分区,就是fdisk /dev/sdb 大家运行这个命令:#fdisk   /dev/sda

linux 磁盘管理+lvm逻辑卷管理

注:linux系统中主分区和扩展分区总共可以有4个,逻辑分区是从5开始. Linux系统中:83(ext3) 82(交换分区) 5(扩展分区) 8E(逻辑卷) b(fat32) 1.查看系统的磁盘以及分区状况 2.查看系统中磁盘的挂载情况以及容量使用情况 3.进入磁盘管理工具 4.P查看磁盘分区 5.N新建,P主分区 6.E新建扩展分区 7.L新建逻辑分区 8.删除一个分区 9.保存分区配置 10.逻辑更改分区格式 11.永久挂载一个磁盘分区 12.格式化分区 Mkfs命令可以格式化ext的,f

Linux下的LVM创建以及Linux快照卷

通过最的学习,我加深了对LVM的理解,在这里,我将它写成博客,一是方便自己记忆,二是让Linux的入门学习者一起学习一下. 首先我们引入LVM的概念,并展开详细的说明,主要是近期学习的看法,我们先看一个图 我们将会提到的名词有:PV.VG.LV.PE 在图中,最下面的,我们可以理解为物理存储介质,硬盘或是分区 PV:称为物理卷,是LVM的基本存储块. VG:称为卷组,我们可以看卷组是由物理卷组合而成的. LV:称为逻辑卷,是从卷组中划分出来的. PE:physical extent,我就称为物理

Linux中的LVM的管理

1.lvm概述 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在Linux 2.4内核上实现.LVM将一个或多个硬盘的分区在逻辑上集合,相当于一个大硬盘来使用,当硬盘的空间不够使用的时候,可以继续将其它的硬盘的分区加入其 中,这样可以实现磁盘空间的动态管理,相对于普通的磁盘分区有很大的灵活性. 与传统的磁盘与分区相比,LVM为计算机提供了更高层次的 磁盘存储.它使系统管理员可以更方便的为应用与用户分配存储空间.在LVM管理下的存