Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all, Fedora 17, 64bit Ubuntu 12.04 desktop 64bit HD 160G Ubuntu 12.04 has been already installed on the HD first, several days ago, taking up the whole disc. Later ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,763

    About shrinking /home to retain space for another dualboot OS


    Hi all,

    Fedora 17, 64bit
    Ubuntu 12.04 desktop 64bit
    HD 160G

    Ubuntu 12.04 has been already installed on the HD first, several days ago, taking up the whole disc. Later I added/installed Fedora 17 selecting the "Shrink" option and saved the bootloader on /dev/sda1 to make them dualboot. Installation is successful with dulaboot option. Unfortunately by mistake I retained insufficient space for Ubuntu 12.04, now only about 100M left when it is up.

    Ubuntu 12.04
    $ df -h
    Code:
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1       4.0G  3.7G  107M  98% /
    udev            3.8G  4.0K  3.8G   1% /dev
    tmpfs           1.6G  880K  1.6G   1% /run
    none            5.0M     0  5.0M   0% /run/lock
    none            3.8G  156K  3.8G   1% /run/shm

    Fedora 17
    $ df -h
    Code:
    Filesystem                       Size  Used Avail Use% Mounted on
    rootfs                            50G  4.0G   46G   9% /
    devtmpfs                         3.8G     0  3.8G   0% /dev
    tmpfs                            3.8G  100K  3.8G   1% /dev/shm
    tmpfs                            3.8G  1.9M  3.8G   1% /run
    /dev/mapper/vg_fedora17-lv_root   50G  4.0G   46G   9% /
    tmpfs                            3.8G     0  3.8G   0% /sys/fs/cgroup
    tmpfs                            3.8G     0  3.8G   0% /media
    /dev/sda3                        497M   60M  413M  13% /boot
    /dev/mapper/vg_fedora17-lv_home   78G  1.4G   72G   2% /home

    There is plenty of space on /home of Fedora 17. Is there any easy way to shrink /home of Fedora 17 and then adding the spare space to / (/dev/sda1) of Ubuntu 12.04? TIA


    B.R.
    satimis

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,107
    Is there any easy way to shrink /home of Fedora 17 and then adding the spare space to / (/dev/sda1)
    Shrinking the Fedora /home partition, no problem. Adding it to could be a big problem. It depends upon which partition it is on. If you want to increase the size of sda1 with Ubuntu you would need to use sda2 and extend sda1 into space you resized from the beginning of sda2. You need to do this with contiguous partitions. You might create another partition just for Ubuntu /home but 4GB is probably too small for a / partition for Ubuntu. I've never used LVM so I don't really know how that would enter in to the problem.

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,763
    Quote Originally Posted by yancek View Post
    Shrinking the Fedora /home partition, no problem. Adding it to could be a big problem. It depends upon which partition it is on. If you want to increase the size of sda1 with Ubuntu you would need to use sda2 and extend sda1 into space you resized from the beginning of sda2. You need to do this with contiguous partitions. You might create another partition just for Ubuntu /home but 4GB is probably too small for a / partition for Ubuntu. I've never used LVM so I don't really know how that would enter in to the problem.
    Hi and all,

    Thanks for your reply.

    This is a spare HD NOT for production. I'll use it testing Cloud running on Fedora 17 and Ubuntu 12.04 respectively. There is not much data nor much work done on both OS. The only work I did several day before was installing rotation desktop on Ubuntu 12.04. It is now working.

    Today I installed Fedora 17 on the freed space by shrinking Ubuntu 12.04 which was taking up the entire HD. Installation went through w/o much problem. Unfortunately I made a mistake on calculating the shrinked space to be retained by Ubuntu 12.04.

    The target on this rectification is mainly for me to learn. I think I have to split the job into 2 sections

    1)
    Shrinking Fedora lv_home

    2)
    Adding the freed space to Ubuntu /


    Would following document be relevant to 1) above?

    9.5. Using the LVM utility system-config-lvm
    http://www.centos.org/docs/5/html/De...onfig-lvm.html


    I'm still hunting around for documents to be used for 2) above.

    Thanks.

    Edit:

    I also found;

    Linux LVM: Resizing partitions.
    http://www.microdevsys.com/WordPress...ng-partitions/


    B.R.
    satimis

  4. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,107
    I don't know. Haven't used LVM but if this is just test systems, go for it. The problem is that data is usually at the beginning of a partition so if you move a partition from the left to the right (say sda2) to give sda1 (Ubuntu) more room, what happens to the data?

  5. #5
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,763
    Hi all,

    I followed;
    How to Shrink an LVM Volume Safely
    How to Shrink an LVM Volume Safely | Random Bits

    to shrink /home of Fedora 17 from 78G to 10G to free 68G space with following steps:-

    Booted up the PC with Fedora 17 live USB

    # vgchange -a y
    Code:
      3 logical volume(s) in volume group "vg_fedora17" now active
    # resize2fs -f /dev/mapper/vg_fedora17-lv_home
    Code:
    resize2fs 1.42 (29-Nov-2011)
    The filesystem is already 20258816 blocks long.  Nothing to do!
    # e2fsck -f /dev/mapper/vg_fedora17-lv_home
    Code:
    e2fsck 1.42 (29-Nov-2011)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/mapper/vg_fedora17-lv_home: 477/5070848 files (5.9% non-contiguous), 383520/20258816 blocks
    # resize2fs /dev/mapper/vg_fedora17-lv_home 9G
    Code:
    resize2fs 1.42 (29-Nov-2011)
    Resizing the filesystem on /dev/mapper/vg_fedora17-lv_home to 2359296 (4k) blocks.
    The filesystem on /dev/mapper/vg_fedora17-lv_home is now 2359296 blocks long.
    # lvreduce -L 10G /dev/vg_fedora17/lv_home
    Code:
      WARNING: Reducing active logical volume to 10.00 GiB
      THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce lv_home? [y/n]: y
      Reducing logical volume lv_home to 10.00 GiB
      Logical volume lv_home successfully resized

    # fdisk -l
    Code:
    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x0000d52d
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048     8263679     4130816   83  Linux
    /dev/sda2       296333310   312580095     8123393    5  Extended
    /dev/sda3         8263680     9287679      512000   83  Linux
    /dev/sda4         9287680   296331263   143521792   8e  Linux LVM
    /dev/sda5       296333312   312580095     8123392   82  Linux swap / Solaris
    
    Partition table entries are not in disk order
    
    Disk /dev/mapper/vg_fedora17-lv_swap: 10.3 GB, 10267656192 bytes
    255 heads, 63 sectors/track, 1248 cylinders, total 20054016 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 /dev/mapper/vg_fedora17-lv_home: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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 /dev/mapper/vg_fedora17-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders, total 104857600 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
    
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb: 4111 MB, 4111466496 bytes
    255 heads, 63 sectors/track, 499 cylinders, total 8030208 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: 0x1d459011
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           0     1320959      660480    0  Empty
    /dev/sdb2             164        1299         568   ef  EFI (FAT-12/16/32)
    /dev/sdb3            1348        3587        1120    0  Empty
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb1'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb1: 676 MB, 676331520 bytes
    255 heads, 63 sectors/track, 82 cylinders, total 1320960 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: 0x1d459011
    
         Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1p1   *           0     1320959      660480    0  Empty
    /dev/sdb1p2             164        1299         568   ef  EFI (FAT-12/16/32)
    /dev/sdb1p3            1348        3587        1120    0  Empty
    
    Disk /dev/mapper/live-rw: 4294 MB, 4294967296 bytes
    255 heads, 63 sectors/track, 522 cylinders, total 8388608 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 /dev/mapper/live-osimg-min: 4294 MB, 4294967296 bytes
    255 heads, 63 sectors/track, 522 cylinders, total 8388608 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

    Rebooted PC to start Fedora 17

    # fdisk -l
    Code:
    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x0000d52d
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048     8263679     4130816   83  Linux
    /dev/sda2       296333310   312580095     8123393    5  Extended
    /dev/sda3         8263680     9287679      512000   83  Linux
    /dev/sda4         9287680   296331263   143521792   8e  Linux LVM
    /dev/sda5       296333312   312580095     8123392   82  Linux swap / Solaris
    
    Partition table entries are not in disk order
    
    Disk /dev/mapper/vg_fedora17-lv_swap: 10.3 GB, 10267656192 bytes
    255 heads, 63 sectors/track, 1248 cylinders, total 20054016 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 /dev/mapper/vg_fedora17-lv_home: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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 /dev/mapper/vg_fedora17-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders, total 104857600 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
    
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    Disk /dev/sdb: 4111 MB, 4111466496 bytes
    
    255 heads, 63 sectors/track, 499 cylinders, total 8030208 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: 0x1d459011
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           0     1320959      660480    0  Empty
    /dev/sdb2             164        1299         568   ef  EFI (FAT-12/16/32)
    /dev/sdb3            1348        3587        1120    0  Empty
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb1'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb1: 676 MB, 676331520 bytes
    255 heads, 63 sectors/track, 82 cylinders, total 1320960 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: 0x1d459011
    
         Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1p1   *           0     1320959      660480    0  Empty
    /dev/sdb1p2             164        1299         568   ef  EFI (FAT-12/16/32)
    /dev/sdb1p3            1348        3587        1120    0  Empty
    
    Disk /dev/mapper/live-rw: 4294 MB, 4294967296 bytes
    255 heads, 63 sectors/track, 522 cylinders, total 8388608 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 /dev/mapper/live-osimg-min: 4294 MB, 4294967296 bytes
    255 heads, 63 sectors/track, 522 cylinders, total 8388608 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

    $ df -h
    Code:
    Filesystem                       Size  Used Avail Use% Mounted on
    rootfs                            50G  2.8G   46G   6% /
    devtmpfs                         3.8G     0  3.8G   0% /dev
    tmpfs                            3.8G   96K  3.8G   1% /dev/shm
    tmpfs                            3.8G  1.1M  3.8G   1% /run
    /dev/mapper/vg_fedora17-lv_root   50G  2.8G   46G   6% /
    tmpfs                            3.8G     0  3.8G   0% /sys/fs/cgroup
    tmpfs                            3.8G     0  3.8G   0% /media
    /dev/sda3                        485M   72M  389M  16% /boot
    /dev/mapper/vg_fedora17-lv_home  8.9G  235M  8.2G   3% /home
    Gparted is NOT running on Fedora 17 live USB.

    I have no solution to resize Ubuntu 12.04 / adding the free space. Neither I found a thread relevant.

    Any advice. TIA

    B.R.
    satimis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •