美文网首页
Space Manipulation of Linux

Space Manipulation of Linux

作者: James_Qiu | 来源:发表于2017-07-20 22:51 被阅读0次

System used: CentOS
Suitable for most other distributions of Linux

Let's say you are given a new disk stored as /dev/xvdb, how can you use this piece of disk to enlarge you space, like /home directory?

  1. Partition the new given hard disk.
    parted /dev/sdc mklabel gpt mkpart primary 2048s 100%

  2. Create file system for it.
    mkfs -t ext4 /dev/xvdf

  3. Back up original files in the directory.
    You can move all files and directories under /home to another place first, because the following manipulations will cover the /home directory.

  4. Mount partitions for it.
    mount /dev/xvdb /home

  5. Update /etc/fstab
    After adding a disk to VM/PH, we need to configure fstab so that the disk is mounted whenever the vm starts. In general, we first mount the disk to the VM manually, then use "blkid" to get the "uuid" of the disk and add configuration to "fstab".

  6. Check if there's errors
    sudo mount -a

By now, you've successfully expanded /home directory with the given new hard disk!

Used tool - Parted: https://www.gnu.org/software/parted/manual/parted.html
Useful commands
parted /dev/xvdb: list partitions in xvdb
blkid: check the uuid of disks
df -h: show the file systems and spaces

相关文章

  • Space Manipulation of Linux

    System used: CentOSSuitable for most other distributions ...

  • [Note-03] Linux下passwd命令设置修改用户密码

    Linux下passwd命令设置修改用户密码_(Authentication token manipulation...

  • JavaNIO-MappedByteBuffer

    内核空间与用户空间 Kernel space 是 Linux 内核的运行空间,User space 是用户程序的运...

  • 如何判断CPU忙

    学习 Linux 时,经常可以看到两个词:User space(用户空间)和 Kernel space(内核空间)...

  • 如何使用 man

    如何使用 man Linux man-pages 项目记录了用户空间(user-space)程序采用的 Linux...

  • Swap

    Linux交换空间(swap space) 转自:https://segmentfault.com/a/11900...

  • 缓冲区溢出的保护机制

    checksec 来查看Linux的保护机制ASLR(PIE):Address Space Layout Rand...

  • Manipulation

    这两天工作比较忙,陪宝宝的时间不多,感觉他有点不高兴。晚上回家跟他互动的时候他开始拿玩具砸我,一开始是小的,然后是...

  • Linux_查看.md

    查看Linux资源信息 Disk Space 查询磁盘空间大小 command : dfname : Repor...

  • linux手册翻译——fallocate(2)

    fallocate - manipulate file space 这是一个不可移植的、特定于 Linux 的系统...

网友评论

      本文标题:Space Manipulation of Linux

      本文链接:https://www.haomeiwen.com/subject/rhtskxtx.html