问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

linux虚拟机卸载新硬盘的方法

发布网友 发布时间:2022-04-20 17:52

我来回答

1个回答

热心网友 时间:2022-04-14 18:04

装载:

1、启动vm,选择vm->Settings,按向导添加一块SCSI磁盘。进入Linux系统。
2、 fdisk -l 会看到有一块新的设置,如果你先前有一块硬盘(sda1, sda3...),新加的这块应该是(/dev/sdb)。
[root@localhost ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda3 14 1044 8281507+ 83 Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

3、分区:
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
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)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda3 14 1044 8281507+ 83 Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux

4、格式化:
[root@localhost ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

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

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

5、装载:
[root@localhost ~]# mount /dev/sdb1 /u01/app/oracle
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.7G 5.8G 576M 92% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 233M 0 233M 0% /dev/shm
/dev/sdb1 7.9G 147M 7.4G 2% /u01/app/oracle

6、编辑fstab文件(不然重启电脑后系统将不会保存之前的挂载操作):

[root@localhost ~]# vi /etc/fstab

/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/sdc1 /u03 ext3 defaults 1 1
/dev/sdb1 /u01/app/oracle ext3 defaults 1 1
# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
# End of the block added by the VMware software
卸载:
[root@localhost ~]# umount /dev/sdb1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.7G 5.8G 576M 92% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 233M 0 233M 0% /dev/shm
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
美国在多少个国家有驻军? 美国在哪些国家有驻军? 美国在哪些国家派有驻军? 美国在其本土以外的驻军有多少 美国都在哪些国家有驻军 空调制热的正确调法 守捉郎与侠客行 《长安十二时辰》乱弹之五 小孩子给母亲节的祝福 孩子送给妈妈的母亲节祝福语句子2024 中国篮球a级教练都是谁 中国互联网并购案的2014年 前段时间QQ音乐不是被处罚版权垄断了吗,为什么现... 腾讯音乐娱乐集团集齐“三大”独家版权后其他平台还... 你认为斗鱼虎牙合并后,直播平台会出现什么变化? 求十大音乐播放器排名 媒体称腾讯或将被罚款15.4亿美元,该消息是否属实... 百度把千千静听收购了,腾讯把酷我音乐收购了,他... 那些年被“马巨头”收购的软件,现在过的怎么样? 既然酷狗、QQ、酷我都隶属于同一家公司,那为什么... 酷我音乐拆分还能经营 腾讯都收购了哪些公司? 腾讯音乐或将放弃独家音乐版权,对于整个市场来将... 腾讯音乐或将放弃独家版权,是否意味着版权时代要... 腾讯已经有了 QQ 音乐,为什么还要收购「酷我」? 这种手摇手电筒 摇着摇着为什么不开开关不亮呢? ... 花呗分期六个月后如果提前还款必须还全部吗 可以先... 蚂蚁花呗还款是全额还是分期? 花呗购买物品直接花呗全款买 然后还钱的时候选择分... 花呗想提高额度,全款还?还是分期还 为什么使用花呗分期还是全额付款? linux安全删除移动硬盘 Linux 系统下有类似Diskpart 的命令去清空磁盘的么? pe怎么 删除linux磁盘文件 如何删除linux系统 跪求2020最新免费高清在线视频,【在线观看】免费... 盘点最新2021国产在线视频,【免费高清】在线观看... 跪求最新在线视频免费观看,【在线观看】免费百度... 盘点2021国产最新精品视频,【在线观看】免费百度... 跪求最新日本高清在线视频,【免费高清】在线观看... 【合集】2021最新国产在线视频,【免费高清】在线... 跪求2021国产最新在线观看视频,【在线观看】免费... 跪求日本最新免费高清视频,【在线观看】免费百度... 盘点2021年最新国产电视在线免费观看,【在线观看... 盘点2021最新日韩视频在线观看,【在线观看】免费... 【合集】2021最新国产视频,【免费高清】在线观看... 盘点国产2021年最新视频,【在线观看】免费百度云资源 河北省邢台市临城县能用江苏省无锡市的公积金贷款吗? 的公积金,户口是邢台,能在石家庄公积金异地贷款吗 异地公积金贷款怎么办理 异地公积金怎么贷款