ubuntu 16.04添加新的分区

网友投稿 236 2022-08-26

ubuntu 16.04添加新的分区

当我们在使用ubuntu过程中,会出现磁盘满了,这个时候如果你还有没有用的空间的话,可以尝试挂载一个新的分区。

我的分区操作为:

➜ sudo fdisk /dev/sdbsudo: unable to resolve host eric-ms-7a54Welcome to fdisk (util-linux 2.27.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): mHelp: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display/entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition tableCommand (m for help): nPartition type p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5)Select (default p): pPartition number (3,4, default 3): First sector (1172658176-1953525167, default 1172658176): Last sector, +sectors or +size{K,M,G,T,P} (1172658176-1953525167, default 1953525167): Created a new partition 3 of type 'Linux' and of size 372.4 GiB.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Re-reading the partition table failed.: Device or resource busyThe 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).➜ sudo fdisk -l sudo: unable to resolve host eric-ms-7a54Disk /dev/loop0: 89.5 MiB, 93818880 bytes, 183240 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop1: 89.5 MiB, 93835264 bytes, 183272 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/loop2: 88.2 MiB, 92483584 bytes, 180632 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0xfc3652c5Device Boot Start End Sectors Size Id Type/dev/sda1 * 4096 312123391 312119296 148.9G 7 HPFS/NTFS/exFAT/dev/sda2 312123392 500113407 187990016 89.7G 7 HPFS/NTFS/exFATDisk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisklabel type: dosDisk identifier: 0x75be86f6Device Boot Start End Sectors Size Id Type/dev/sdb1 * 2046 782335 780290 381M 5 Extended/dev/sdb2 782336 1172658175 1171875840 558.8G 83 Linux/dev/sdb3 1172658176 1953525167 780866992 372.4G 83 Linux/dev/sdb5 2048 782335 780288 381M 83 LinuxPartition 1 does not start on physical sector boundary.Partition table entries are not in disk order.

这个时候需要重启一下,重启之后:

➜ ~ sudo mkfs.ext4 /dev/sdb3 sudo: unable to resolve host eric-ms-7a54[sudo] password for eric: mke2fs 1.42.13 (17-May-2015)Creating filesystem with 97608374 4k blocks and 24403968 inodesFilesystem UUID: d9025617-7c7c-4557-91c8-e98de7bed874Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done ➜ ~ mount -t ext4 /dev/sdb3 /home/eric/data mount: only root can use "--types" option➜ ~ sudo mount -t ext4 /dev/sdb3 /home/data sudo: unable to resolve host eric-ms-7a54mount: mount point /home/data does not exist➜ ~ sudo mount -t ext4 /dev/sdb3 /home/eric/data sudo: unable to resolve host eric-ms-7a54➜ ~ df -h Filesystem Size Used Avail Use% Mounted onudev 16G 0 16G 0% /devtmpfs 3.2G 9.7M 3.2G 1% /run/dev/sdb2 550G 516G 6.6G 99% /tmpfs 16G 30M 16G 1% /dev/shmtmpfs 5.0M 4.0K 5.0M 1% /run/locktmpfs 16G 0 16G 0% /sys/fs/cgroup/dev/loop0 90M 90M 0 100% /snap/core/6130/dev/loop1 90M 90M 0 100% /snap/core/6034/dev/loop2 89M 89M 0 100% /snap/core/5897/dev/sdb5 361M 232M 107M 69% /boottmpfs 3.2G 52K 3.2G 1% /run/user/1000/dev/sr0 5.9M 5.9M 0 100% /media/eric/FAST/dev/sdb3 367G 67M 348G 1% /home/eric/data

然后sdb3就挂载到我创建的/home/eric/data目录了哈

设置开机自动挂载:

vim /etc/fstab/dev/sdb3 /home/eric/data ext4 defaults 1 0

按esc :wq保存退出,本人测试,重启没啥问题

参考文献

[1]. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

[2].Ubuntu添加新分区

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:keras 2.x python3看图说话模型一步一步的搭建
下一篇:[leetcode] 258. Add Digits
相关文章

 发表评论

暂时没有评论,来抢沙发吧~