Skip to content

Instantly share code, notes, and snippets.

@bobbydavid
Last active July 22, 2019 19:58

Revisions

  1. bobbydavid revised this gist Feb 23, 2013. 2 changed files with 1 addition and 1 deletion.
    1 change: 1 addition & 0 deletions 4_mount_partition
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # 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"
    1 change: 0 additions & 1 deletion 5_copy_files
    Original file line number Diff line number Diff line change
    @@ -1,2 +1 @@
    # mkfs -t ext4 /mnt/home
    # time rsync -aXS --exclude='/*/.gvfs' /home/. /mnt/home/.
  2. bobbydavid revised this gist Feb 23, 2013. 6 changed files with 1 addition and 1 deletion.
    File renamed without changes.
    File renamed without changes.
    1 change: 0 additions & 1 deletion write_partition_table → 3_write_partition_table
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    Command (m for help): w
    The partition table has been altered!

    File renamed without changes.
    1 change: 1 addition & 0 deletions copy_files → 5_copy_files
    Original file line number Diff line number Diff line change
    @@ -1 +1,2 @@
    # mkfs -t ext4 /mnt/home
    # time rsync -aXS --exclude='/*/.gvfs' /home/. /mnt/home/.
    File renamed without changes.
  3. bobbydavid created this gist Feb 23, 2013.
    1 change: 1 addition & 0 deletions copy_files
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    # time rsync -aXS --exclude='/*/.gvfs' /home/. /mnt/home/.
    45 changes: 45 additions & 0 deletions create_extended_partition
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    $ 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


    25 changes: 25 additions & 0 deletions create_logical_partition
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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
    10 changes: 10 additions & 0 deletions mount_partition
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # 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

    4 changes: 4 additions & 0 deletions move_partition
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # umount /mnt/home
    # vim /etc/fstab # change /mnt/home to /home in fstab. save.
    # mv /home /home_old
    # mount /home
    10 changes: 10 additions & 0 deletions write_partition_table
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@

    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.