Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)
2014-01-21 17:36
316 查看
通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载
fdisk -l[root@MyVPS ~]# fdisk -l
Disk /dev/xvda: 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/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 1044 8281507+ 8e Linux LVMDisk /dev/xvdb: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System对/dev/xvdb(此名称因系统而异)进行分区:
fdisk /dev/xvdb[root@MyVPS ~]# fdisk /dev/xvdb
The number of cylinders for this disk is set to 2871.
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)输入n新建分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p/dev/xvdb中第1个分区
Partition number (1-4): 1
First cylinder (1-2871, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2871, default 2871):
Using default value 2871输入W保存退出
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.将新分区xvdb1(此名称因系统而异)格式化为ext3格式mkfs -t ext3 /dev/xvdb1[root@MyVPS ~]# mkfs -t ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2883584 inodes, 5765319 blocks
288265 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
176 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, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.我们示范将新分区xvdb1挂载到目录/home1
新建目录/home1,然后挂载
mkdir /home1mount /dev/xvdb1 /home1完成后我们通过df -hal可以看到,新分区已经挂载到目录/home1上了
[root@MyVPS ~]# df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 1.4G 4.1G 25% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/xvda1 99M 28M 67M 30% /boot
tmpfs 256M 0 256M 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
/dev/xvdb1 22G 173M 21G 1% /home1最后添加开机自动挂载:echo “/dev/xvdb1 /home1 ext3 defaults 1 2″ >> /etc/fstab这样就完成了!
通过面板重装后的处理重新建立目录/home1,然后重新挂载,xvdb1的文件内容不受影响mkdir /home1mount /dev/xvdb1 /home1最后,重新添加自动挂载即可:echo “/dev/xvdb1 /home1 ext3 defaults 1 2″ >> /etc/fstab
fdisk -l[root@MyVPS ~]# fdisk -l
Disk /dev/xvda: 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/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 1044 8281507+ 8e Linux LVMDisk /dev/xvdb: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System对/dev/xvdb(此名称因系统而异)进行分区:
fdisk /dev/xvdb[root@MyVPS ~]# fdisk /dev/xvdb
The number of cylinders for this disk is set to 2871.
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)输入n新建分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p/dev/xvdb中第1个分区
Partition number (1-4): 1
First cylinder (1-2871, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2871, default 2871):
Using default value 2871输入W保存退出
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.将新分区xvdb1(此名称因系统而异)格式化为ext3格式mkfs -t ext3 /dev/xvdb1[root@MyVPS ~]# mkfs -t ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2883584 inodes, 5765319 blocks
288265 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
176 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, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.我们示范将新分区xvdb1挂载到目录/home1
新建目录/home1,然后挂载
mkdir /home1mount /dev/xvdb1 /home1完成后我们通过df -hal可以看到,新分区已经挂载到目录/home1上了
[root@MyVPS ~]# df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 1.4G 4.1G 25% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/xvda1 99M 28M 67M 30% /boot
tmpfs 256M 0 256M 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
/dev/xvdb1 22G 173M 21G 1% /home1最后添加开机自动挂载:echo “/dev/xvdb1 /home1 ext3 defaults 1 2″ >> /etc/fstab这样就完成了!
通过面板重装后的处理重新建立目录/home1,然后重新挂载,xvdb1的文件内容不受影响mkdir /home1mount /dev/xvdb1 /home1最后,重新添加自动挂载即可:echo “/dev/xvdb1 /home1 ext3 defaults 1 2″ >> /etc/fstab
相关文章推荐
- 腾讯云Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)
- Linux VPS 挂载磁盘ext3格式(重装系统数据不丢失)
- LINUX系统的VPS里挂载第二个硬盘且重装系统数据也不会丢失
- Linux VPS新硬盘分区与挂载教程
- Linux VPS新硬盘分区与挂载教程,阿里云主机同理
- Linux VPS新硬盘分区与挂载教程
- 创建硬链接避免重装系统数据丢失
- Vuejs入门教程之Vue生命周期,数据,手动挂载,指令,过滤器
- 硬盘分区损坏后数据恢复方法[分区恢复,分区修复,分区丢失,数据恢复,数据丢失,数据修复]
- 重装系统后,硬盘分区丢失的解决办法
- 硬盘数据丢失具体恢复教程
- 如何重装Citrix XenServer不丢失SR数据
- raid-6磁盘阵列损坏导致数据丢失的恢复过程(图文教程)
- u盘数据丢失数据恢复图文教程
- 重装系统后,硬盘分区丢失的解决办法
- 阿里云CentOS数据盘挂载教程
- win7自带无损分区且数据不丢失图文教程
- 硬盘分区数据丢失怎么恢复
- 重装系统后管家婆数据库丢失,数据库碎片扫描、提取、重组数据恢复
- 云VPS linux系统数据盘挂载教程