日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

VisualBox中增大linux硬盘空间的方法

發布時間:2024/9/30 linux 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VisualBox中增大linux硬盘空间的方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1:在VisualBox的安裝目錄命令行中執行

VBoxManage.exe modifyhd e:\os\RedHat5.6.vdi --resize 20000

把RedHat5.6.vdi 改為20G,必須停止虛擬機

2:進入linux,root操作

fdisk -l?

可以看到/dev/sda變 21G了。

[jifeng@jifeng04 ~]$ su - 密碼: [root@jifeng04 ~]# fdisk -lDisk /dev/sda: 21.0 GB, 20971520000 bytes 255 heads, 63 sectors/track, 2549 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: 0x0001395dDevice Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1045 7875584 8e Linux LVMDisk /dev/mapper/VolGroup-lv_root: 3833 MB, 3833593856 bytes 255 heads, 63 sectors/track, 466 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: 0x00000000Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes 255 heads, 63 sectors/track, 514 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: 0x00000000從1046到2549沒有劃分磁盤,也就是說這一部分是未分區的。

3:創建分區

[root@jifeng04 ~]# df -lh 文件系統 容量 已用 可用 已用%% 掛載點 /dev/mapper/VolGroup-lv_root3.6G 1.7G 1.7G 50% / tmpfs 939M 0 939M 0% /dev/shm /dev/sda1 485M 32M 429M 7% /boot[root@jifeng04 ~]# fdisk /dev/sdaWARNING: DOS-compatible mode is deprecated. It's strongly recommended toswitch off the mode (command 'c') and change display units tosectors (command 'u').Command (m for help): m Command actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partitionl list known partition typesm print this menun add a new partitiono create a new empty DOS partition tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partition's system idu change display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only)Command (m for help): n Command actione extendedp primary partition (1-4) p Partition number (1-4): 1 Partition 1 is already defined. Delete it before re-adding it.Command (m for help): n Command actione extendedp primary partition (1-4) p Partition number (1-4): 2 Partition 2 is already defined. Delete it before re-adding it.Command (m for help): n Command actione extendedp primary partition (1-4) p Partition number (1-4): 3 First cylinder (1045-2549, default 1045): Using default value 1045 Last cylinder, +cylinders or +size{K,M,G} (1045-2549, default 2549): Using default value 2549Command (m for help): w The partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 設備或資源忙. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.多出了一個sda3
[root@jifeng04 ~]# fdisk -lDisk /dev/sda: 21.0 GB, 20971520000 bytes 255 heads, 63 sectors/track, 2549 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: 0x0001395dDevice Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 1045 7875584 8e Linux LVM /dev/sda3 1045 2549 12086234+ 83 LinuxDisk /dev/mapper/VolGroup-lv_root: 3833 MB, 3833593856 bytes 255 heads, 63 sectors/track, 466 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: 0x00000000Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes 255 heads, 63 sectors/track, 514 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: 0x00000000
必須重啟

[root@jifeng04 ~]# reboot
4:格式化

[root@jifeng04 ~]# mkfs.ext3 /dev/sda3 mke2fs 1.41.12 (17-May-2010) 文件系統標簽= 操作系統:Linux 塊大小=4096 (log=2) 分塊大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 755904 inodes, 3021558 blocks 151077 blocks (5.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=3095396352 93 block groups 32768 blocks per group, 32768 fragments per group 8128 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208正在寫入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成This filesystem will be automatically checked every 36 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 5:掛載硬盤
[root@jifeng04 /]# mount -t ext3 /dev/sda3 /storage [root@jifeng04 /]# df -h 文件系統 容量 已用 可用 已用%% 掛載點 /dev/mapper/VolGroup-lv_root3.6G 1.7G 1.7G 50% / tmpfs 939M 0 939M 0% /dev/shm /dev/sda1 485M 32M 429M 7% /boot /dev/sda3 12G 157M 11G 2% /storage

6:自動掛載硬盤

vi /etc/fstab,最后一行加上

[root@jifeng04 ~]# cat /etc/fstab# # /etc/fstab # Created by anaconda on Thu Jul 31 18:17:27 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/VolGroup-lv_root / ext4 defaults 1 1 UUID=c60714d0-963f-417e-b171-33f3cd10ea25 /boot ext4 defaults 1 2 /dev/mapper/VolGroup-lv_swap 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 /dev/sda3 /storage ext3 defaults 1 2

總結

以上是生活随笔為你收集整理的VisualBox中增大linux硬盘空间的方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。