ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:63.76KB ,
资源ID:10146568      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10146568.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(linux磁盘分区详解.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

linux磁盘分区详解.docx

1、linux磁盘分区详解1 磁盘及分区格式化公司的一台Linux开发主机在安装时/home没有独立分区,随着用户不断增多,经常因根分区磁盘空间耗尽而故障频发,为了解决这些问题,现要新增加一块SCSI 硬盘,并将用户目录“/home”中的数据迁移到该硬盘中。1添加一块80GB的SCSI接口的新硬盘,从中划分出一个20GB的主分区。2将新划出的20GB的分区格式化为EXT3文件系统,替换掉现有的/home目录。3迁移后不影响系统原有用户账号的使用。4从其余空间中划出2GB逻辑分区作交换空间、划出10GB逻辑分区作FAT32分区。1查看当前的磁盘分区情况1)直接通过“fdisk -l”查看1. roo

2、tsvr5 # fdisk -l2. 3. Disk /dev/sda:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id System8. /dev/sda1 *11310439183 Linux9. /dev/sda2 1425632048287583 Linux10. /dev/sda3 256428242096482+82 Linu

3、x swap / Solaris2)通过“fdisk 磁盘设备”查看执行以下操作:1. rootsvr5 # fdisk /dev/sda2. .然后会进入到fdisk的交互式程序界面,输入指令p可查看分区情况:1. The number of cylinders forthis disk is set to 10443.2. There is nothing wrong with that, but this is larger than 1024,3. and could in certain setups cause problems with:4. 1) software that r

4、uns at boot time(e.g., old versions of LILO)5. 2) booting and partitioning software from other OSs6. (e.g., DOS FDISK, OS/2 FDISK)7. 8. Command(m for help): p9. 10. Disk /dev/sda:85.8 GB,85899345920 bytes11. 255 heads,63 sectors/track,10443 cylinders12. Units = cylinders of 16065*512=8225280 bytes13

5、. 14. Device Boot Start End Blocks Id System15. /dev/sda1 *11310439183 Linux16. /dev/sda2 1425632048287583 Linux17. /dev/sda3 256428242096482+82 Linux swap / Solaris关于fdisk交互的操作指令,可根据提示输入指令m获得。1. Command(m for help): m /执行m指令列出帮助信息2. Command action3. a toggle a bootable flag4. b edit bsd disklabel5.

6、 c toggle the dos compatibility flag6. d delete a partition / d 删除一个分区7. l list known partition types / l 列出已知的分区类型8. m print this menu / m 获得帮助9. n add a new partition / n 添加一个新的分区10. o create a new empty DOS partition table11. p print the partition table / p 查看分区表12. q quit without saving changes

7、/ q 不保存退出13. s create a new empty Sun disklabel14. t change a partitions system id / t 更改分区的类型标记15. u change display/entry units16. v verify the partition table17. w write table to disk and exit / w 保存退出18. x extra functionality (experts only)2为RHEL 5虚拟机添加一块新磁盘1)添加磁盘将虚拟机关闭电源,通过“编辑虚拟机设置”-“添加”-“硬盘”-“创

8、建一个新的磁盘”-“SCSI(建议)”-“磁盘大小”设为80GB-“完成”,最终添加一块容量为80GB的SCSI接口的虚拟磁盘,如图-1所示。图2)识别新磁盘重新打开虚拟机电源,登入Linux系统,执行fdisk -l确认新识别的硬盘。一般是硬盘序号靠后的,没有包含任何分区的空磁盘就是,比如/dev/sdb:1. rootsvr5 # fdisk -l2. 3. Disk /dev/sda:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512

9、=8225280 bytes6. 7. Device Boot Start End Blocks Id System8. /dev/sda1 *11310439183 Linux9. /dev/sda2 1425632048287583 Linux10. /dev/sda3 256428242096482+82 Linux swap / Solaris11. 12. Disk /dev/sdb:85.8 GB,85899345920 bytes /新增加的磁盘13. 255 heads,63 sectors/track,10443 cylinders14. Units = cylinders

10、of 16065*512=8225280 bytes15. 16. Disk /dev/sdb doesnt contain a valid partition table17. /提示没有有效的分区表3为新加的磁盘/dev/sdb规划分区1)执行“fdisk /dev/sdb”命令进入分区界面:1. rootsvr5 # fdisk /dev/sdb2. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3. Building a new DOS disklabel. Chang

11、es will remain in memory only,4. until you decide to write them. After that, of course, the previous5. content wont be recoverable.6. 7. The number of cylinders for this disk is set to 10443.8. There is nothing wrong with that, but this is larger than 1024,9. and could in certain setups cause proble

12、ms with:10. 1) software that runs at boot time (e.g., old versions of LILO)11. 2) booting and partitioning software from other OSs12. (e.g., DOS FDISK, OS/2 FDISK)13. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)14. 15. Command (m for help): /等待输入交互指令输入p指令后按Enter键,可列

13、出当前的分区表,可以看到还没有任何分区:1. Command(m for help): p / p 查看分区表2. 3. Disk /dev/sdb:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id System2)创建第一个主分区 /dev/sdb1执行 n 指令以新建分区:1. Command(m for help): n / n 新

14、建分区2. Command action3. e extended4. p primary partition(1-4)根据提示执行 p 指令,表示要新建一个主分区(若按e表示新建扩展分区);然后依次输入分区序号 1、起始柱面(默认)、结束柱面 +20G:1. p /新建一个主分区2. Partition number(1-4):1 /使用的分区序号为13. First cylinder(1-10443,default1):4. Using default value 15. Last cylinder or +size or +sizeM or +sizeK(1-10443,default1

15、0443):+20G设置完毕又回到等待状态,再次执行 p 指令可确认刚新建的分区/dev/sdb1:1. Command(m for help): p2. 3. Disk /dev/sdb:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id System8. /dev/sdb1 124331954304183 Linux3)创建第二个主分区

16、 /dev/sdb2再次执行 n 指令以新建分区:1. Command(m for help): n2. Command action3. e extended4. p primary partition(1-4)根据提示再次执行 p 指令,表示要新建的还是一个主分区;然后依次输入分区序号 2、起始柱面(默认)、结束柱面 +20G:1. p /再新建一个主分区2. Partition number(1-4):2 /使用的分区序号为23. First cylinder(2434-10443,default2434):4. Using default value 24345. Last cylin

17、der or +size or +sizeM or +sizeK(2434-10443,default10443):+20G执行 p 指令确认新的分区结果,可看到新划分出的 /dev/sdb2:1. Command(m for help): p2. 3. Disk /dev/sdb:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id Sys

18、tem8. /dev/sdb1 124331954304183 Linux9. /dev/sdb2 2434486619543072+83 Linux4)新建扩展分区 /dev/sdb4再次执行 p 指令以新建分区:1. Command(m for help): n2. Command action3. e extended4. p primary partition(1-4)此时选e表示将选择建扩展分区;接下来分区序号选4(四个主分区位置就只剩下3和4可选,任用其中一个)、起始柱面(默认)、结束柱面(默认),将剩余的全部空间都分给扩展分区:1. e2. Partition number(1-

19、4):4 /使用的分区序号为43. First cylinder(4867-10443,default4867):4. Using default value 48675. Last cylinder or +size or +sizeM or +sizeK(4867-10443,default10443):执行 p 指令确认新的分区结果,可看到新增加的扩展分区 /dev/sdb4:1. Command(m for help): p2. 3. Disk /dev/sdb:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 c

20、ylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id System8. /dev/sdb1 124331954304183 Linux9. /dev/sdb2 2434486619543072+83 Linux10. /dev/sdb4 48671044344797252+5 Extended5)新建逻辑分区 /dev/sdb5、/dev/sdb6再次执行 n 指令以新建分区:1. Command(m for help): n2. Command action3.

21、 l logical(5 or over)4. p primary partition(1-4)此时因为扩展分区已建立,所以不再提供e可选,而是变为l(逻辑分区),p 虽然还可选,但实际上已经没有可分配空间了,选了也没用。别无选择,只有选l,表示将要建立一个逻辑分区(容量2GB):1. l /新建一个逻辑分区2. First cylinder(4867-10443,default4867):3. Using default value 48674. Last cylinder or +size or +sizeM or +sizeK(4867-10443,default10443):+2G继续

22、再建立另一个10GB的逻辑分区:1. Command(m for help): n2. Command action3. l logical(5 or over)4. p primary partition(1-4)5. l /再新建一个逻辑分区6. First cylinder(5111-10443,default5111):7. Using default value 51118. Last cylinder or +size or +sizeM or +sizeK(5111-10443,default10443):+10G执行 p 指令确认分区结果,可看到新增加的逻辑分区 /dev/sd

23、b5、/dev/sdb6:1. Command(m for help): p2. 3. Disk /dev/sdb:85.8 GB,85899345920 bytes4. 255 heads,63 sectors/track,10443 cylinders5. Units = cylinders of 16065*512=8225280 bytes6. 7. Device Boot Start End Blocks Id System8. /dev/sdb1 124331954304183 Linux9. /dev/sdb2 2434486619543072+83 Linux10. /dev/

24、sdb4 48671044344797252+5 Extended11. /dev/sdb5 486751101959898+83 Linux12. /dev/sdb6 51116327977552183 Linux6)修改分区 /dev/sdb5、/dev/sdb6 的类型标识执行 l 指令以列出已知的16进制分区类型代码(EXT为83、交换分区为82、FAT32大分区为c):1. Command(m for help): l2. 3. 0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris4. 1 FAT12 24 NEC DOS 81 Min

25、ix / old Lin c1 DRDOS/sec(FAT-5. 2 XENIX root 39 Plan 982 Linux swap / So c4 DRDOS/sec(FAT-6. 3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec(FAT-7. 4 FAT16 32M 40 Venix 8028684 OS/2 hidden C: c7 Syrinx8. 5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data9. 6 FAT16 42 SFS 86 NTFS volum

26、e set db CP/M / CTOS /.10. 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility11. 8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt12. 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access13. a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O14. b W95 FAT32 51 OnTrack DM6 Aux 94 Am

27、oeba BBT e4 SpeedStor15. c W95 FAT32(LBA)52 CP/M 9f BSD/OS eb BeOS fs16. e W95 FAT16(LBA)53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT17. f W95 Extd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/18. 10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b19. 11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP

28、f1 SpeedStor20. 12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor21. 14 Hidden FAT16 3 61 SpeedStor a9 NetBSD f2 DOS secondary22. 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS23. 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE24. 18 AST SmartSleep 65 N

29、ovell Netware b8 BSDI swap fd Linux raid auto25. 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep26. 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT执行 t 指令以更改分区类型、目标分区序号为5、类型标识改为82:1. Command(m for help): t /修改分区类型2. Partition number(1-6):5 /修改/dev/sdb53. Hex code(type L to list codes):82 /类型改为82(交换分区)4. Cha

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1