Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
Hi folks, I need to repartition the existing HD which is only running FedoraCore3 # df -hT Code: Filesystem Type Size Used Avail Use% Mounted on /dev/hda2 ext3 20G 3.6G ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804

    Repartition question


    Hi folks,

    I need to repartition the existing HD which is only running FedoraCore3

    # df -hT
    Code:
    Filesystem    Type    Size  Used Avail Use% Mounted on
    /dev/hda2     ext3     20G  3.6G   15G  20% /
    /dev/hda1     ext3     99M   14M   80M  15% /boot
    none         tmpfs    125M     0  125M   0% /dev/shm
    /dev/hda5     ext3     17G  2.4G   14G  16% /home
    # fdisk -l /dev/hda
    Code:
    Disk /dev/hda: 40.0 GB, 40020664320 bytes
    255 heads, 63 sectors/track, 4865 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
    Device   Boot      Start         End      Blocks   Id  System
    /dev/hda1   *           1          13      104391   83  Linux
    /dev/hda2              14        2563    20482875   83  Linux
    /dev/hda3            2564        2690     1020127+  82  Linux swap
    /dev/hda4            2691        4865    17470687+   5  Extended
    /dev/hda5            2691        4865    17470656   83  Linux
    I'm prepared to repartition /dev/hda5 into 3 partitions for

    a partition (3G) for LFS (Linux From Scratch)
    a partition (2G) for holding the image of Live CD created from LFS
    /home (balance)

    1) Shall I shrink the Extended partition, /dev/hda4? How to do it?
    2) What shall be the appropriate steps to do the job? With "fdisk" OR with "parted" OR other ways? Any document/article referred to?

    Please advise. TIA

    B.R.
    satimis

  2. #2
    Linux Engineer psic's Avatar
    Join Date
    Nov 2004
    Location
    Ljubljana, Slovenia
    Posts
    1,205
    I think qtparted should be what you are looking for.
    Stumbling around the 'net:
    www.cloudyuseful.com

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Hi psic,

    Tks for your advice,

    I think qtparted should be what you are looking for.
    What is the difference between 'qtparted' and 'gpart'

    TIA

    B.R.
    satimis

  4. #4
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817

    Re: Repartition question

    Quote Originally Posted by satimis
    1) Shall I shrink the Extended partition, /dev/hda4?
    You do not want to "shrink" your extended partition. Instead, you want to shrink or remove your logical partition hda5 which is contained in extended partition hda4. If you shrink hda5, you will then be able to add one or more additional logical partitions. Your first logical partition (hda5) will begin at cylinder 2691 and your last logical partition will end at cylinder 4865. (review your output from 'fdisk -l /dev/hda' to understand this)

    If it were me, I'd copy the contents of hda5 /home to the /home directory of your root on hda2. Then you would be free to delete hda5 which will allow you to resize hda4 with fdisk or cfdisk (some prefer cfdisk) and without need for qparted. Since you have a generous 20Gb for the root partition, you may want to leave your /home files there. Alternately, you could move them back to a new downsized hda5.

    You may be able to safely and correctly copy your /home files as follows, logged in as root (instead of su):
    Code:
    mkdir /mnt/move
    umount -l /dev/hda5
    mount /dev/hda5 /mnt/move
    cp -av /mnt/move/* /home/
    umount /dev/hda5
    rmdir /mnt/move
    Edit /etc/fstab: put a '#' character (without the quotes) at the beginning of the line which reads
    Code:
    /dev/hda5   /home     ....
    Read the man pages for all commands that are new to you.
    /IMHO
    //got nothin'
    ///this use to look better

  5. #5
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804

    Re: Repartition question

    Hi drakebasher,

    Tks for your advice.

    I'll follow your advice to repartition /dev/hda5 on "Single User Mode" to 3 new partitions, namely;
    /dev/hda5
    /dev/hda6
    /dev/hda7

    The data of /home (old /dev/hda5) will be moved back to /dev/hda5 (new partition) afterwards.

    Then you would be free to delete hda5 which will allow you to resize hda4 with fdisk or cfdisk (some prefer cfdisk)....
    Sorry I can't follow. Whether after deleting /de/hda5 the existing Extended partition /dev/hda4 wiil increase its size automatically including the size of the deleted /dev/hda5 and become a primary partition. After repartition whether /dev/hda4 still exists. How to get it off. Because I only need 3 new partitions;

    /dev/hda4 (primary for /home)
    /dev/hda5 (Extended for /LFS)
    /dev/hda6 (Extended for /Live CD)

    Edit /etc/fstab
    I'll edit this file adding;
    /dev/hda6 /mount/pt/to/LFS ext3 default 1 2
    /dev/hda7 /mount/pt/to/Live CD ext3 default 1 2

    If I can get rid of /dev/hda4 making it as primary partition I'll edit /etc/fstab as;
    LABEL=/home /home ext3 defaults 1 2
    dev/hda5 /mount/pt/to/LFS ext3 default 1 2
    /dev/hda6 /mount/pt/to/Live CD ext3 default 1 2

    Please advise. TIA

    B.R.
    satimis

  6. #6
    Linux Engineer
    Join Date
    Mar 2005
    Posts
    1,431
    As allready mentioned, you can't just change hda4 to a primary. If so, you must delete the whole extended partition, you should instead remove hda5 and create new logical partitions inside the allready existing hda4. hda4 is just a container which allow you to create more partitions than 4.

  7. #7
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Hi jaboua,

    FedoraCore3

    Tks for your advice.

    I understand your explanation. I was trying to find out whether after repartition an Extended partition /dev/hda4 would still be there. I have no idea how it was created duing installation.

    I installed FC3 from CDs. I only created following partitions
    /boot
    /
    /swap
    /home

    I have no idea how the Extended partition /dev/hda4 came to existence.

    Any idea. TIA

    B.R.
    satimis

  8. #8
    Linux Engineer
    Join Date
    Mar 2005
    Posts
    1,431
    Fedora (and a bunch of other distros) automaticly create extended partitions if you try to create more than 4 partitions, but if you want to completely repartitionate without care for your data, you can boot up a livecd and use fdisk to remove the extended and create a primary instead. Fdisk does'nt create extended partitions if you don't ask for it. If your root partition does'nt lie at the extended, you can repartitionate from inside fedora aswell.

  9. #9
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817
    Just to clarify, satimis:
    Due to limitations built into the x86 architecture a long time ago (I think in relation to the BIOS), a hard drive can have no more than 4 partitions. To work past this limitation, the concept of extended and logical partitions was designed into software at a level higher than BIOS: an extended partition may serve as a container for multiple logical partitions. In partitioning the drive, you are able to "tag" a partition as an extended partition and you are able to set the size of it. Like any container, the extended partition must be at least as large as the sum of what it holds: that is, the sum of the logical partitions. The extended partition cannot hold anything except logical partitions: it cannot hold files or directories. So if you create an extended partition, you must create at least one logical partition to use the space assigned to the extended partition. Normally, in order to use the entire drive, the extended partition should end at the last cylinder of the drive, as yours does. In the current scheme, a drive may have up to 4 primary partitions only or it may have up to 3 primary partitions in addition to only one extended partition.
    Quote Originally Posted by satimis
    I have no idea how the Extended partition /dev/hda4 came to existence.
    I think Fedora presumes that if you have at least 4 partitions, that one of them should be extended. It is not necessary to have an extended partition, but when partitioning a drive, if one doesn't have immediate plans for all space on the drive, an extended partition can be created to hold the space to be populated by future logical partitions.
    /IMHO
    //got nothin'
    ///this use to look better

  10. #10
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804

    Hard drive repartition finished

    H folks,

    I got my HD repartitioned. Steps taken as follows;

    1. Boot into "init 1" (GRUB Bootloader)

    2.
    sh-3.00# mount /dev/hda5 /mnt
    Already mount

    3.
    sh-3.00# mkdir /home2 && cp -ar /mnt/* /home2/

    4.
    sh-3.00# umount /dev/hda5

    5.
    Used fdisk to delete partition hda5 and to recreate 3 new partitions in the space left

    sh-3.00# fdisk /dev/hda
    Command (m for help): (type) d
    Partition number (1-5): (type) 5

    Command (m for help): (type) n
    First cylinder (2691-4865, defult 2691): press [Enter]
    Using default value 2691
    Last cylinder of +size or +sizeM or +sizeK (2691-4865, default 4865): (type) +10000M and press [Enter]

    Command (m for help): (type) n and press [Enter]
    First cylinder (3908-4865, defult 390: press [Enter]
    Using default value 3908
    Last cylinder of +size or +sizeM or +sizeK (3908-4865, default 4865): (type) +6000M and press [Enter]

    Command (m for help): (type) n and press [Enter]
    First cylinder (4638-4865, defult 463: press [Enter]
    Using default value 4638
    Last cylinder of +size or +sizeM or +sizeK (4638-4865, default 4865): press [Enter]

    Command (m for help): (type) w and press [Enter]

    Partition table has been altered!
    Calling ioctl() to read partition table
    Warning: Re-reading the partition table failed with error 16: Device and resource busy
    The kernel still uses the old table
    The new table will be used at the next reboot
    Syncing disk

    sh-3.00# (type) reboot and press [Enter]

    FedoraCore3 rebooted and step 1. above was repeated to boot into "init 1" again.
    Now the trick was here.

    At end of booting a warning popup requesting to enter password and run "fsck". I tried half an hour to get it fixed without result. Then I continued as follows.

    # mkfs -t ext3 /dev/hda5
    # mkfs -t ext3 /dev/hda6
    # mkfs -t ext3 /dev/hda7

    All worked without complaint.

    Actually It was already running on "init 1" We can omit step 1. above after reboot and let the PC boot automatically. The it will boot into "init 1" finally.

    6.
    # cp -ar /home2/* /home/
    Another trick happened here. It seemed copying all data back to /home. The Hard Drive was working with the pilot light on.

    # mkdir /mnt/LFS
    # mkdir /mnt/LiveCD

    7.
    Edited /etc/fstab

    Original /etc/fstab before editing;
    # cat /etc/fstab
    # This file is edited by fstab-sync - see 'man fstab-sync' for details
    LABEL=/ / ext3 defaults 1 1
    LABEL=/boot /boot ext3 defaults 1 2
    none /dev/pts devpts gid=5,mode=620 0 0
    none /dev/shm tmpfs defaults 0 0
    LABEL=/home /home ext3 defaults 1 2
    none /proc proc defaults 0 0
    none /sys sysfs defaults 0 0
    /dev/hda3 swap swap defaults 0 0
    /dev/hdd /media/cdrom auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0
    /dev/hdc /media/cdrecorder auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0
    /dev/fd0 /media/floppy auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0

    Changed
    LABEL=/home /home ext3 defaults 1 2
    to
    /dev/hda5 /home ext3 defaults 1 2

    Added:
    /dev/hda6 /mnt/LFS ext3 defaults 1 2
    /dev/hda7 /mnt/LiveCD ext3 defaults 1 2

    /etc/fstab after editing;
    # This file is edited by fstab-sync - see 'man fstab-sync' for details
    LABEL=/ / ext3 defaults 1 1
    LABEL=/boot /boot ext3 defaults 1 2
    none /dev/pts devpts gid=5,mode=620 0 0
    none /dev/shm tmpfs defaults 0 0
    /dev/hda5 /home ext3 defaults 1 2
    none /proc proc defaults 0 0
    none /sys sysfs defaults 0 0
    /dev/hda3 swap swap defaults 0 0
    /dev/hda6 /mnt/LFS ext3 defaults 1 2
    /dev/hda7 /mnt/LiveCD ext3 defaults 1 2
    /dev/hdd /media/cdrom auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0
    /dev/hdc /media/cdrecorder auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0
    /dev/fd0 /media/floppy auto pamconsole,exec,noauto,fscontext=system_u:object_r :removable_t,managed 0 0
    Reboot the PC again

    PC rebooted without problem to Login screen. I was not allowed to login as user �satimis� saying /home/satimis/ not found. But I was allowed to login as Root

    After login as Root I discovered /home being empty. After copying all files from /home2 back to /home. Login and relogin. This time I was allowed to login as "satimis"

    Now
    # fdisk -l /dev/hda
    Code:
    Disk /dev/hda: 40.0 GB, 40020664320 bytes
    255 heads, 63 sectors/track, 4865 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *           1          13      104391   83  Linux
    /dev/hda2              14        2563    20482875   83  Linux
    /dev/hda3            2564        2690     1020127+  82  Linux swap
    /dev/hda4            2691        4865    17470687+   5  Extended
    /dev/hda5            2691        3907     9775521   83  Linux
    /dev/hda6            3908        4637     5863693+  83  Linux
    /dev/hda7            4638        4865     1831378+  83  Linux
    # df -hT
    Code:
    Filesystem    Type    Size  Used Avail Use% Mounted on
    /dev/hda2     ext3     20G  6.3G   12G  35% /
    /dev/hda1     ext3     99M   14M   80M  15% /boot
    none         tmpfs    125M     0  125M   0% /dev/shm
    /dev/hda5     ext3    9.2G  1.4G  7.4G  16% /home
    /dev/hda6     ext3    5.6G   44M  5.2G   1% /mnt/LFS
    /dev/hda7     ext3    1.8G   35M  1.6G   3% /mnt/LiveCD
    Comments are appreciated. TIA

    B.R.
    satimis

Page 1 of 2 1 2 LastLast

Posting Permissions

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