磁盘是怎么分区的在文章后面会谈到,先谈一下Linux文件系统的简单操作。不过在阅读本文之前,我假定读者们对Linux的磁盘与文件系统以及目录树已经有了初步的了解。...sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes...,z表示的是硬盘序号,第一块硬盘是a,第二块硬盘是b,所以要查询Linux系统上有几块硬盘,只要注意这一点即可。...sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes...Disk /dev/mapper/cl-root: 8585 MB, 8585740288 bytes, 16769024 sectors Units = sectors of 1 * 512 =
当前包含磁盘 [root@xifenfei ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track...of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 2355 18916506 83 Linux..., 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start...End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux Disk /dev/sdc: 2147 MB, 2147483648 bytes 255.../dev/sdd2 101 1000 7229250 83 Linux Disk /dev/sde: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track
# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512...identifier: 0x00043041 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux.../dev/sda2 2099200 20971519 9436160 8e Linux LVM Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520...4096 bytes / 4096 bytes 2、可以看到红色标注的是10G的数据磁盘,我们现在执行分区,代码如下: # fdisk /dev/vdb Welcome to fdisk (util-linux.../dev/sda2 2099200 20971519 9436160 8e Linux LVM Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520
Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders.../dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB,...21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280...Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders.../dev/sdd2 101 1000 7229250 83 Linux 查看iscsi运行情况 [root@xifenfei ~]# rpm -aq
Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux.../dev/sda2 2099200 41943039 19921920 8e Linux LVM Disk /dev/mapper/cl-root: 18.2 GB..., 18249416704 bytes, 35643392 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical...' to 'Linux LVM' Command (m for help): p #打印分区,可看到类型修改为8e,linux LVM Disk /dev/sdb: 10.7 GB, 10737418240...bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes
说明: 当Linux系统的硬盘空间不够时,我们需要添加新的硬盘。本文物理添加硬盘的方法略过,只介绍在linux系统的分区、格式化和挂载的内容。.../dev/sda2 1026048 62914559 30944256 8e Linux LVM Disk /dev/mapper/centos-swap: 4194...MB, 4194304000 bytes, 8192000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical...fdisk /dev/sdb命令进入磁盘进行分区 [root@localhost.localdomain:/root] # fdisk /dev/sdb Welcome to fdisk (util-linux...G} (2048-209715199, default 209715199): <===直接回车 Using default value 209715199 Partition 1 of type Linux
Size Id Type /dev/vda1 * 2048 104855551 104853504 50G 83 Linux Disk /dev/vdb: 50 GiB, 53687091200...optimal): 512 bytes / 512 bytes 5.3.对磁盘vdb进行分区 root@zstest:~# fdisk /dev/vdb Welcome to fdisk (util-linux...or +size{K,M,G,T,P} (2048-104857599, default 104857599): Created a new partition 1 of type 'Linux'...Size Id Type /dev/vda1 * 2048 104855551 104853504 50G 83 Linux Disk /dev/vdb: 50 GiB, 53687091200...Size Id Type /dev/vdb1 2048 104857599 104855552 50G 83 Linux 5.5.重新载入磁盘分区信息 [root@zstest ~]#
' to 'Linux LVM' Command (m for help): p Disk /dev/vdb: 53.7 GB, 53687091200 bytes, 104857600 sectors..., 104857600 sectors /dev/vdb1 2048 104857599 52427776 8e Linux LVM Disk /dev/vdc:...' to 'Linux LVM' Command (m for help): p Disk /dev/vdc: 53.7 GB, 53687091200 bytes, 104857600 sectors..., 104857600 sectors /dev/vdb1 2048 104857599 52427776 8e Linux LVM Disk /dev/vdc:..., 104857600 sectors /dev/vdb1 2048 104857599 52427776 8e Linux LVM Disk /dev/vdc:
Size Id Type /dev/sda1 * 2048 999423 997376 487M 83 Linux /dev/sda2 1001470 209713151 208711682 99.5G...Disk /dev/mapper/Ubuntu-root: 95.5 GiB, 102563315712 bytes, 200318976 sectors Units: sectors of 1 * 512...200G 83 Linux Partition 2 does not start on physical sector boundary....type (type L to list all types): 8e # LVM 类型的 Id 代码 Changed type of partition 'Linux' to 'Linux LVM'...200G 8e Linux LVM Partition 2 does not start on physical sector boundary.
/fdisk -l Disk /dev/sda: 5.5 TiB, 6000606183424 bytes, 11719933952 sectors Units: sectors of 1 * 512...Size Type /dev/sda1 4096 33558527 33554432 16G Linux swap /dev/sda2 33558528 34607103...1048576 512M Linux filesystem /dev/sda3 34607104 11719933918 11685326815 5.5T Linux filesystem...Disk /dev/sdb: 446.6 GiB, 479559942144 bytes, 936640512 sectors Units: sectors of 1 * 512 = 512 bytes...Size Id Type /dev/sdb1 2048 936640511 936638464 446.6G 83 Linux
Precondition :VMware Player 中安装的Fedora 17 Linux 32bit,个人较久远的测试环境,安装时没有进行磁盘规划,默认20G空间(动态调整),安装在根/下。.../track, 3916 cylinders, total 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical.../dev/sda2 1026048 16777215 7875584 8e Linux LVM /dev/sda3 16777216 62914559 23068672 83 Linux Disk...sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes...当然,此方案针对虚拟机中已安装的没有采用LVM的linux分区大小调整,其它不必参考此方案。
Disk identifier: 0x0008ce60 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux.../dev/sda2 2099200 1048567807 523234304 8e Linux LVM Disk /dev/mapper/vg_root-lv_root: 64.4 GB, 64424509440.../dev/sda2 2099200 1048567807 523234304 8e Linux LVM Disk /dev/mapper/vg_root-lv_root: 64.4 GB, 64424509440...Disk identifier: 9C5E039C-2C6C-4585-8EAB-7B2DBA949516 # Start End Size Type Name 1 34 4294965343 2T Linux...Disk identifier: 9C5E039C-2C6C-4585-8EAB-7B2DBA949516 # Start End Size Type Name 1 34 4294965343 2T Linux
[Targets: 0] /iscsi> create Created target iqn.2003-01.org.linux-iscsi.storage-b.x8664:sn.46b1dc2750be...[Targets: 1] o- iqn.2003-01.org.linux-iscsi.storage-b.x8664:sn.46b1dc2750be ..........................[Targets: 1] | o- iqn.2003-01.org.linux-iscsi.storage-b.x8664:sn.46b1dc2750be ........................[ACLs: 1] | | o- iqn.2003-01.org.linux-iscsi.storage-b.x8664:sn.46b1dc2750be:client ..............:sn.46b1dc2750be 10.10.2.21:3260,1 iqn.2003-01.org.linux-iscsi.storage-b.x8664:sn.46b1dc2750be 登陆连接:
查看磁盘 [root@yzb-centos72-3 ~]# fdisk -l Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 sectors...swap / Solaris /dev/vda2 * 4194304 56623103 26214400 83 Linux Disk /dev/vdb: 107.4...GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical...分区 [root@yzb-centos72-3 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2)....GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors of 1 * 512 = 512 bytes...Command (m for help): p Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors Units = sectors...618496 823295 102400 83 Linux /dev/vdb6 825344 1030143 102400 83 Linux...sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes...618496 823295 102400 83 Linux /dev/vdb6 825344 1030143 102400 82 Linux
1): #直接回车 First sector (2048-41943039, default 2048): #直接回车 Using default value 2048 Last sector, +sectors...Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size...5242880 83 Linux Command (m for help): #w 保存退出 The partition table has been altered!...Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size...Disk /dev/mapper/xcloudvg-xcloudlv: 12.9 GB, 12884901888 bytes, 25165824 sectors Units = sectors of 1
Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size...~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2)....Command (m for help): p Disk /dev/sda: 66.6 GB, 66571993088 bytes, 130023424 sectors Units = sectors...L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p...Disk /dev/sda: 66.6 GB, 66571993088 bytes, 130023424 sectors Units = sectors of 1 * 512 = 512 bytes Sector
109362 844479488 83 Linux Disk /dev/sdc: 1999.1 GB, 1999114010624 bytes 255 heads, 63 sectors...src]# cd linux/ [root@data-node01 linux]# ls Lib_Utils-1.00-09.noarch.rpm MegaCli-8.00.48-1.i386.rpm...] Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors] Coerced Size: 3.637 TB [0x1d1b00000 Sectors] Firmware...] Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors] Coerced Size: 3.637 TB [0x1d1b00000 Sectors] Firmware...109362 844479488 83 Linux Disk /dev/sdc: 2006.8 GB, 2006810624000 bytes 255 heads, 63 sectors
互联网上搜索到的 Linux 环境新磁盘配置方法资料质量都不尽如人意,因此自己整理了一份,日常 Linux 磁盘分区时查阅足够了,主要是用到了 fdisk 命令。...Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors Disk model: ST4000NM000A-2HZ Units: sectors...Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors Disk model: ST4000NM000A-2HZ Units: sectors.../dev/sdc1 3.6T 89M 3.4T 1% /home/songtianlun/data 参考文献# linux系统下添加新硬盘、分区及挂载全过程详解 Linux如何为新硬盘分区并挂载...(mount)到指定目录下 Linux 磁盘管理 By 菜鸟教程 Linux下mount挂载新硬盘和开机自动挂载 硬盘分区时GPT和MBR的区别/选择 Linux主分区,扩展分区,逻辑分区的联系和区别
Start End Blocks Id System /dev/vda1 * 2048 83875364 41936658+ 83 Linux...Disk /dev/vdb: 536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * 512 = 512 bytes...code (type L to list all codes): Hex code (type L to list all codes): 8e Changed type of partition 'Linux...' to 'Linux LVM' Command (m for help): w The partition table has been altered!.../dm-0 7 格式化 mkfs.ext4 /dev/vgdata/lvdata mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux
领取专属 10元无门槛券
手把手带您无忧上云