linux下home目录迁移
来源:互联网 发布:北京阿里云招聘 编辑:程序博客网 时间:2024/05/01 03:19
根分区预留不宽裕,du -sh /home 发现home分区占比较大,于是将home目录迁移到新的分区
#添加硬盘后触发扫描echo '- - -' > /sys/class/scsi_host/host2/scan[389][root@liyong: etc]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 40G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 39G 0 part ├─cl-root 253:0 0 35.1G 0 lvm / └─cl-swap 253:1 0 3.9G 0 lvm [SWAP]sdb 8:16 0 100G 0 disk sr0 11:0 1 7.7G 0 rom #分区gdisk /dev/sdbGPT fdisk (gdisk) version 0.8.6Partition table scan: MBR: not present BSD: not present APM: not present GPT: not presentCreating new GPT entries.Command (? for help): pDisk /dev/sdb: 209715200 sectors, 100.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): AAB88154-BBA6-4134-9D99-E2168AF3B8F6Partition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 209715166Partitions will be aligned on 2048-sector boundariesTotal free space is 209715133 sectors (100.0 GiB)Number Start (sector) End (sector) Size Code NameCommand (? for help): nPartition number (1-128, default 1): 1First sector (34-209715166, default = 2048) or {+-}size{KMGTP}: Last sector (2048-209715166, default = 209715166) or {+-}size{KMGTP}: +10GCurrent type is 'Linux filesystem'Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem'Command (? for help): ?b back up GPT data to a filec change a partition's named delete a partitioni show detailed information on a partitionl list known partition typesn add a new partitiono create a new empty GUID partition table (GPT)p print the partition tableq quit without saving changesr recovery and transformation options (experts only)s sort partitionst change a partition's type codev verify diskw write table to disk and exitx extra functionality (experts only)? print this menuCommand (? for help): l0700 Microsoft basic data 0c01 Microsoft reserved 2700 Windows RE 4200 Windows LDM data 4201 Windows LDM metadata 7501 IBM GPFS 7f00 ChromeOS kernel 7f01 ChromeOS root 7f02 ChromeOS reserved 8200 Linux swap 8300 Linux filesystem 8301 Linux reserved 8e00 Linux LVM a500 FreeBSD disklabel a501 FreeBSD boot a502 FreeBSD swap a503 FreeBSD UFS a504 FreeBSD ZFS a505 FreeBSD Vinum/RAID a580 Midnight BSD data a581 Midnight BSD boot a582 Midnight BSD swap a583 Midnight BSD UFS a584 Midnight BSD ZFS a585 Midnight BSD Vinum a800 Apple UFS a901 NetBSD swap a902 NetBSD FFS a903 NetBSD LFS a904 NetBSD concatenated a905 NetBSD encrypted a906 NetBSD RAID ab00 Apple boot af00 Apple HFS/HFS+ af01 Apple RAID af02 Apple RAID offline af03 Apple label af04 AppleTV recovery af05 Apple Core Storage be00 Solaris boot bf00 Solaris root bf01 Solaris /usr & Mac Zbf02 Solaris swap bf03 Solaris backup bf04 Solaris /var bf05 Solaris /home bf06 Solaris alternate se bf07 Solaris Reserved 1 bf08 Solaris Reserved 2 bf09 Solaris Reserved 3 bf0a Solaris Reserved 4 bf0b Solaris Reserved 5 c001 HP-UX data c002 HP-UX service ed00 Sony system partitio ef00 EFI System ef01 MBR partition schemeef02 BIOS boot partition fb00 VMWare VMFS fb01 VMWare reserved fc00 VMWare kcore crash p fd00 Linux RAID Command (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!Do you want to proceed? (Y/N): yOK; writing new GUID partition table (GPT) to /dev/sdb.The operation has completed successfully.lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 40G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 39G 0 part ├─cl-root 253:0 0 35.1G 0 lvm / └─cl-swap 253:1 0 3.9G 0 lvm [SWAP]sdb 8:16 0 100G 0 disk └─sdb1 8:17 0 10G 0 part sr0 11:0 1 7.7G 0 rom 分区:mkfs.xfs /dev/sdb1meta-data=/dev/sdb1 isize=512 agcount=4, agsize=655360 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0data = bsize=4096 blocks=2621440, imaxpct=25 = sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=1log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0#挂载mkdir /mnt/sdb1[395][root@liyong: etc]# mount /dev/sdb1 /mnt/sdb1[396][root@liyong: etc]# blkid/dev/sr0: UUID="2016-12-05-13-52-39-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" /dev/sda1: UUID="c7821fc5-6546-4c67-9749-452eb7da28a6" TYPE="xfs" /dev/sda2: UUID="JkiPfL-PCvJ-3hc2-9gAx-NT3x-vki5-kNPDtM" TYPE="LVM2_member" /dev/mapper/cl-root: UUID="153220ce-da95-45d4-aa79-67d33efdcc88" TYPE="xfs" /dev/mapper/cl-swap: UUID="4509fe4b-faa7-4788-8d70-1ef7b9003ad6" TYPE="swap" /dev/sdb1: UUID="10266f0d-7b03-4d1f-9af2-604477c3ecf6" TYPE="xfs" PARTLABEL="Linux filesystem" PARTUUID="f5410f79-88e3-4f64-8cf7-d1d0255146c3" #备份迁移原来文件夹的内容(确保不再写入,需进入单用户模式操作)[root@liyong: sdb1]# init 1PolicyKit daemon disconnected from the bus.We are no longer a registered authentication agent.Broadcast message from root@liyong on pts/0 (Tue 2017-04-25 23:46:37 CST):The system is going down to rescue mode NOW!cd /mnt/sdb1cp -a /home/* ./[root@liyong: sdb1]# du -sh ./18M ./[root@liyong: sdb1]# du -sh /home18M /home#备份成功后删除home下数据rm -rf /mome/*#讲分区挂载到/home下mount /dev/sdb1 /home#写入配置文件UUID="10266f0d-7b03-4d1f-9af2-604477c3ecf6" TYPE="xfs" /home xfs defaults 0 0#重启init 3#至此迁移工作完成
0 0
- linux下home目录迁移
- Linux 下如何迁移home
- Linux下Chrome安装目录巧迁移
- linux下 mysql data目录迁移
- 迁移Home目录到独立分区
- 迁移/home目录到单独分区
- linux 误删home目录
- linux添加用户名,并在/home下生成用户名目录
- linux新硬盘挂在到/home目录下
- linux添加用户名,并在/home下生成用户名目录
- linux如何将新硬盘挂载到home目录下
- linux 下配置NIS和nfs /home目录
- linux mysql目录迁移
- linux如何迁移目录?
- Linux home目录下各默认目录目录名的修改
- MAC 下修改 HOME 目录
- linux 改变home目录 脚本
- 迁移/home
- MATLAB实现控制系统的根轨迹分析
- 【Python专题】python入门之一:搭建开发环境
- 秒懂!何凯明的深度残差网络PPT是这样的|ICML2016 tutorial
- hadoop nfs网关
- 动态规划学习【一】
- linux下home目录迁移
- KMP
- 计蒜客 无脑博士 bfs
- matlab极限导数积分初步
- jvm内存调优及原理的学习笔记
- 好好学习数据结构
- git hook实现代码自动部署
- hadoop hive基本操作
- DHCP基础