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 ...
- 05-28-2005 #1Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Repartition question
Hi folks,
I need to repartition the existing HD which is only running FedoraCore3
# df -hT# fdisk -l /dev/hdaCode: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
I'm prepared to repartition /dev/hda5 into 3 partitions forCode: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
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
- 05-30-2005 #2
I think qtparted should be what you are looking for.
Stumbling around the 'net:
www.cloudyuseful.com
- 05-31-2005 #3Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Hi psic,
Tks for your advice,
What is the difference between 'qtparted' and 'gpart'I think qtparted should be what you are looking for.
TIA
B.R.
satimis
- 05-31-2005 #4Linux Guru
- Join Date
- May 2004
- Location
- forums.gentoo.org
- Posts
- 1,814
Re: Repartition question
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)
Originally Posted by satimis
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):Edit /etc/fstab: put a '#' character (without the quotes) at the beginning of the line which readsCode:mkdir /mnt/move umount -l /dev/hda5 mount /dev/hda5 /mnt/move cp -av /mnt/move/* /home/ umount /dev/hda5 rmdir /mnt/move
Read the man pages for all commands that are new to you.Code:/dev/hda5 /home ....
/IMHO
//got nothin'
///this use to look better
- 06-01-2005 #5Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
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.
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;Then you would be free to delete hda5 which will allow you to resize hda4 with fdisk or cfdisk (some prefer cfdisk)....
/dev/hda4 (primary for /home)
/dev/hda5 (Extended for /LFS)
/dev/hda6 (Extended for /Live CD)
I'll edit this file adding;Edit /etc/fstab
/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
- 06-01-2005 #6Linux 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.
- 06-01-2005 #7Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
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
- 06-01-2005 #8Linux 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.
- 06-01-2005 #9Linux Guru
- Join Date
- May 2004
- Location
- forums.gentoo.org
- Posts
- 1,814
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.
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.
Originally Posted by satimis /IMHO
//got nothin'
///this use to look better
- 06-02-2005 #10Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
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# df -hTCode: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
Comments are appreciated. TIACode: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
B.R.
satimis


Reply With Quote
