how to DEcrease disk size

Place to discuss Fedora and/or Red Hat
User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Fri Apr 22, 2011 2:27 pm

DOH!!
am I stupid or what lol
well now since I don't have grub installed anymore, can I install that on the new disk with my repo or the CD?
and THEN :P use grub-install

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Re: how to DEcrease disk size

Post by Void Main » Fri Apr 22, 2011 2:34 pm

Yes you can, Boot in rescue mode, mount your file systems, chroot to the new file system and install package from CD. Otherwise boot your old drives, mount your root file system from the new drive, chroot into it and yum install grub.

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Fri Apr 22, 2011 5:00 pm

I mounted the DVD (with some problem due to bad memory)
I chrooted my old system, but when "inside" that I can't "see" the DVD

If I mount the DVD using the old disk then I see the DVD files, but I need to do that when chrooted to the new disk, right?
but when I'm chrooted to the new disk, the /dev only has 'null' as a device listed.

What am I doing wrong here, I've done this before I think, but now it just won't work.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Re: how to DEcrease disk size

Post by Void Main » Fri Apr 22, 2011 5:13 pm

Worst case you could rsync it again and it should only copy the files that are missing or changed.

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Fri Apr 22, 2011 5:28 pm

MAN!!!! I sure am stupid today.
Why didn't I think of that. That would get the grub to be installed again.
DOH!!

thx man

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Sat Apr 23, 2011 5:41 pm

I've been fiddling with this for some days now and still can't get it to work. :(
and as latest I've done this:...

I added the "new" HDD...
rsync'd files from all partitions from the old HDD to the new like this:
(sda is the old HDD, sdb is the new HDD)

Code: Select all

[root@unknown 2]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              16G   12G  3.2G  80% /
tmpfs                 470M     0  470M   0% /dev/shm
/dev/sda1              99M   81M   14M  86% /boot
/dev/sda4              95G   34G   57G  38% /data
/dev/sdb1             297M   86M  196M  31% /mnt/1
/dev/sdb2              25G   13G   12G  52% /mnt/2
/dev/sdb4             158G   34G  116G  23% /mnt/4

cd /mnt/1/
rsync -ax /boot .

cd /mnt/2/
rsync -ax --exclude='/boot/' --exclude='/mnt/1/' --exclude='/mnt/2/' --exclude='/mnt/3/' --exclude='/mnt/4/' --exclude='/data/' / .

cd /mnt/4/
rsync -ax /data .
(I might have written something wrong here...)

If I chroot to the "new" system I can't grub-install to /dev/sdb/ since that device don't exist there, so no chroot-ing

I try:

Code: Select all

grub-install --recheck /dev/sdb
but the new disk just won't boot properly :(
I've been trying different versions of all this, also kinda trashed the /dev/sda/ (the old disk) but I fixed that so I can still the the system up(still... since no bad blocks on important files... yet)

I'm trying to get the NEW disk working before I switch to it or using a rescue disk, if that's even possible but I got that from what you told me last.

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Sun Apr 24, 2011 5:51 pm

If I with rescue mode and chroot into /mnt/sysimage I get error:

Code: Select all

bash-4.0# grub-install /dev/sda
Could not find device for 
and yes, the text is cut off

I also tried this(with some help from others):

Code: Select all

mount /dev/sda2 /mnt/1
mount /dev/sda1 /mnt/1/boot
mount --bind /dev /mnt/1/dev
mount --bind /proc /mnt/1/proc
mount --bind /sys /mnt/1/sys
chroot /mnt/1

grub-install /dev/sda
Could not find device for 
also tried this:

Code: Select all

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
grub-install --root-directory=/mnt /dev/sda

/sbin/grub: Not found
I also removed all partitions, remade them and reformat, rsync'd all files again and still same errors.
Either me or others seems to know what this is.

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Mon Apr 25, 2011 2:27 pm

I tried another approach now.

Code: Select all

root (hd0,1)
setup (hd0)
First goes OK saying something about the file format being ext2
but the 'setup' stops after checking for '/boot/grub/stage1' and '/grub/stage1' and reporting as not found.
The files are there in 'boot/grub/' (under: /mnt/sysimage)
But I also see the '.' (dot) in the file access list for all the files and I know that is for selinux.

Code: Select all

rw-r--r--.
I never used selinux but haven't uninstalled it, just being there as permissive.
Can't find any process of selinux (if it named something like that, can't remember)

can 'selinux' has something to do with it?

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Mon Apr 25, 2011 2:55 pm

It's supposed to be:

Code: Select all

root (hd0,0)
setup (hd0)
The grub installation seemed OK, but at boot time I got this:

Code: Select all

no root device found
mapscrn: cannot found map file _iso15_ 

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Re: how to DEcrease disk size

Post by Void Main » Mon Apr 25, 2011 4:01 pm

I don't have a good picture of exactly what you are doing but if I were doing this I would do what I said at the beginning.

- Copy the file systems over to the new drive
- update the fstab on the new drive to reflect what the new device names (or UUIDs if you are using those instead of device names) and file system types (if different). If moving to different file system types you might also have to make sure the initrd includes proper modules for that new file system type
- update the grub.conf on the new drive to reflect the new root device (or UUID if that is what you use) in the kernel params
- change/add the new device name (if different) to the device.map file under your boot/grub on the new drive
- remove old drive and boot into rescue mode from CD/DVD. Mount file systems and chroot into the new environment and run "grub-install <appropriatedevicename>".

The only other thing I can think of is to make sure your boot partition on the new drive is toggled bootable in fdisk. I've never had a problem that I recall doing any of this and have done it several times in the past.

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Mon Apr 25, 2011 4:23 pm

The latest thing I got is that the grub.conf was relating to UUID so I changed that to /dev/sda2.
Then it started to boot, but then lots relating to this UUID same and it stopped booting.
I'm gonna keep fiddling with this tomorrow and also try to remove the UUID use.
The weird part is that 'df-h' show "normal" devicename's on THIS machine but not another one also using F12.

thx

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Re: how to DEcrease disk size

Post by Void Main » Mon Apr 25, 2011 5:17 pm

Basher52 wrote:The latest thing I got is that the grub.conf was relating to UUID so I changed that to /dev/sda2.
Then it started to boot, but then lots relating to this UUID same and it stopped booting.
I'm gonna keep fiddling with this tomorrow and also try to remove the UUID use.
The weird part is that 'df-h' show "normal" devicename's on THIS machine but not another one also using F12.

thx
The UUIDs for the new file systems will not be the same as the old file systems. You have to use the proper ones in the fstab and on the kernel boot paramater (if you use UUID there). Get the UUID of the file system You can see which file systems have which uuids a couple of ways:

ls -l /dev/disk/by-uuid/

or

tune2fs -l /dev/sda2 | grep UUID

User avatar
Basher52
guru
guru
Posts: 918
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Re: how to DEcrease disk size

Post by Basher52 » Tue Apr 26, 2011 1:15 pm

As usual you are correct.
I didn't think of this UUID since the webserver that also (still) uses F12 uses UUID and I see that in the 'df -h' but I don't see that in 'df -h' on this server
and that made me not to think of it. I changed to the correct UUID in fstab and grub.conf and it started OK.

MANY thanks once a again :D

Post Reply