Last active
July 22, 2019 19:58
-
-
Save bobbydavid/5021185 to your computer and use it in GitHub Desktop.
How I moved my home directory to its own partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo su | |
# fdisk /dev/sda | |
Command (m for help): p | |
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes | |
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors | |
Units = sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disk identifier: 0xff3231fe | |
Device Boot Start End Blocks Id System | |
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT | |
/dev/sda2 206848 419432447 209612800 7 HPFS/NTFS/exFAT | |
/dev/sda3 419441148 833934147 207246500 7 HPFS/NTFS/exFAT | |
Command (m for help): n | |
Partition type: | |
p primary (3 primary, 0 extended, 1 free) | |
e extended | |
Select (default e): e | |
Selected partition 4 | |
First sector (419432448-3907029167, default 419432448): | |
Using default value 419432448 | |
Last sector, +sectors or +size{K,M,G} (419432448-419441147, default 419441147): | |
Using default value 419441147 | |
Command (m for help): p | |
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes | |
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors | |
Units = sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disk identifier: 0xff3231fe | |
Device Boot Start End Blocks Id System | |
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT | |
/dev/sda2 206848 419432447 209612800 7 HPFS/NTFS/exFAT | |
/dev/sda3 419441148 833934147 207246500 7 HPFS/NTFS/exFAT | |
/dev/sda4 833935360 3907028991 1536546816 5 Extended | |
Partition table entries are not in disk order | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command (m for help): n | |
All primary partitions are in use | |
Adding logical partition 5 | |
First sector (833935360-3907028991, default 833935360): 2147483647 | |
Last sector, +sectors or +size{K,M,G} (419434496-419441147, default 419441147): | |
Using default value 419441147 | |
Command (m for help): p | |
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes | |
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors | |
Units = sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disk identifier: 0xff3231fe | |
Device Boot Start End Blocks Id System | |
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT | |
/dev/sda2 206848 419432447 209612800 7 HPFS/NTFS/exFAT | |
/dev/sda3 419441148 833934147 207246500 7 HPFS/NTFS/exFAT | |
/dev/sda4 833935360 3907028991 1536546816 5 Extended | |
/dev/sda5 2147483647 3907028991 879772672+ 83 Linux | |
Partition table entries are not in disk order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command (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: Device or resource busy. | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mkfs -t ext4 /dev/sda4 | |
# blkid | |
/dev/loop0: UUID="77bbe3db-8b03-4b7f-afba-cf5b1176f369" TYPE="ext4" | |
/dev/sda1: LABEL="System Reserved" UUID="B416B99416B957D6" TYPE="ntfs" | |
/dev/sda2: UUID="BAD6C1F7D6C1B3C3" TYPE="ntfs" | |
/dev/sda3: UUID="DC70F9F470F9D56C" TYPE="ntfs" | |
/dev/sda5: UUID="695279c9-4800-41d7-bd1f-f32d324c617f" TYPE="ext4" | |
# echo 'UUID=695279c9-4800-41d7-bd1f-f32d324c617f /mnt/home ext4 nodev,nosuid 0 2' >>/etc/fstab | |
# mkdir /mnt/home | |
# mount /mnt/home | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# time rsync -aXS --exclude='/*/.gvfs' /home/. /mnt/home/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# umount /mnt/home | |
# vim /etc/fstab # change /mnt/home to /home in fstab. save. | |
# mv /home /home_old | |
# mount /home |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment