LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-15-2015, 03:54 PM   #1
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 863

Rep: Reputation: 45
Problem moving /usr to a new partition


I have tried moving my /usr directory to a partition on a new disc.

It was /dev/sda6 on an ext3 file system (20GB) and should now be on /dev/sdb8 on an ext4 filesystem.(100GB)

The last time I tried I booted the PC with Knoppix 7.4 and performed the copy with Dolphin in su mode.

Problem 1: I get more files on the new partition than the one I copied from! (Using Properties, maybe counting 500,000+ files is not totally accurate)

Problem2: When I set the new partition to mount on /usr I get errors during startup.

Code:
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/sdb8
fsck exited with status code 8
done
The system then tries to go into maintenance mode but then this happens:

Code:
sulogin: cannot open password database
segfault at 4 ip 080491f6 sp bf992130 error 4 in sulogin[8048000 +3000]
The boot continues and the PC seems to work OK but rebooting gives the same errors all over again.

My WORKING fstab is:
(some no relevant comments deleted)

Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc /proc proc defaults 0 0


# /dev/sda1    = /
/dev/disk/by-uuid/c22032e6-9df4-4cc9-a1ff-9b2698b4a2b7 / ext3 nouser,defaults,errors=remount-ro,atime,auto,rw,dev,exec,suid 0 1


# /dev/sda5   = /home
UUID=2b97a3c0-3541-4263-9a52-4d43f470d189 /home ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

# /dev/sda6 /usr
UUID=bfb6ba6b-5e7e-4ec3-b433-3b891d9bc564 /usr ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2
/dev/sdb8 /usr1 ext4 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

# /dev/sda7 = /var
UUID=dfede468-63fe-4589-aef0-a723cc4beebc /var ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

#  /dev/sda8 = /tmp
UUID=ae203065-71b7-4760-8609-9ee346394895 /tmp ext3 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

/dev/sda9 none swap sw 0 0
#/dev/SDA9 is the Swap Partition

#SDB

/dev/sdb5 /mnt/virtual    ext4 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2
/dev/sdb6 /multimedia ext4 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2
/dev/sdb7 /data ext4 nouser,defaults,atime,auto,rw,dev,exec,suid 0 2

# NFS mounts

 RAMA:/home /mnt/RAMA/home nfs user,defaults,atime,auto,rw,dev,exec,suid 0 0
 RAMA:/srv /mnt/RAMA/server nfs user,defaults,atime,auto,rw,dev,exec,suid,vers=3 0 0
 RAMA:/store /mnt/RAMA/store nfs user,defaults,atime,auto,rw,dev,exec,suid 0 0
 RAMA:/var/back_ups /mnt/RAMA/backups nfs user,defaults,atime,auto,rw,dev,exec,suid 0 0
usr1 is the copy. When I switch /usr and /usr1 I get the error.

I assume that if I get rid of the first error:

Code:
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/sdb8
fsck exited with status code 8
the problem will be solved. Any help appreciated. Do I need to run some configuration program after making this change?

It takes over 3 hours to copy the directory so I don't really want to be repeating the exercise blindly.
 
Old 02-15-2015, 07:05 PM   #2
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
I think you should replace the device name for its UUID (you can get its UUID with blkid). Also, make sure that it's actually formatted in ext4 and not in any other FS type.

Last edited by Hungry ghost; 02-15-2015 at 07:06 PM.
 
Old 02-15-2015, 07:51 PM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
When you format a partition the format program may change the UUID. Check to make sure that the UUID in fstab is the same as the UUID actually on the partition.

---------------------
Steve Stites
 
Old 02-15-2015, 08:13 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by davcefai View Post
The last time I tried I booted the PC with Knoppix 7.4 and performed the copy with Dolphin in su mode.

Problem 1: I get more files on the new partition than the one I copied from! (Using Properties, maybe counting 500,000+ files is not totally accurate)
Ugh. I hate using GUI tools - use cp/rsync from the cli and you'll know what's actually happening. Maybe links are being mishandled - but that many files in /usr ? (edit - I read it as 500,000 extra).
Quote:
Problem2: When I set the new partition to mount on /usr I get errors during startup.
Do the fsck manually yourself - same as above, you need to know what's happening.

Last edited by syg00; 02-15-2015 at 08:39 PM.
 
Old 02-16-2015, 03:04 AM   #5
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 863

Original Poster
Rep: Reputation: 45
Thanks for the responses.

I replaced "/dev/sdb8" bu the UUID of the partition. No improvement and the fsck error still talks about not finding /dev/sdb8

The partition is formatted as ext4. I checked with df -T

Jailbait wrote

Quote:
When you format a partition the format program may change the UUID. Check to make sure that the UUID in fstab is the same as the UUID actually on the partition.
I don't understand this. I generated the UUID using blkid. What checks can I make? (And is this still relevant since I generated the UUID after the format?)

Sygoo: On the old (trouble free) usr I have 554,598 files in 56,045 sub folders. There's a lot on this machine, which is why I felt the need to upgrade the hard discs.

Manual fsck

I have not managed to do this. I pass the parameter Linux single to LILO. The boot sequence goes through the same errors as I described in my original post and then I end up in maintenence mode. I can log in but cannot unmount /usr to fsck it. Am I missing something out?


Thoughts: This is the first time I am using ext4, also having /usr on a different disc to my boot disc. Could either of these be a cause of the problem?

Thanks in advance for any help.
 
Old 02-16-2015, 03:33 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Do the fsck from a liveCD.
I would check your initrd to see if it knows about the old /usr.
 
Old 02-16-2015, 04:20 AM   #7
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/sdb8
Check output of 'ls -l /dev/sdb8'

Can you try recopying usr to new disc again.

This time with cp -dpr /usr /* /usr1
 
Old 02-16-2015, 03:26 PM   #8
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
cp command won't work. You'll have to use the mv command.
Since you used the cp command your /usr should still be intact on sda6.
Check sda6 to confirm.
If it's ok then you'll have to removed everything that is in sdb8.
The way I did it was just like what you're attempting, but had to do it from live-cd, because after move was made I couldn't complete because all of the tools that are necessary are in /usr.

Quote:
mkdir /usr1
from live-cd I used
Quote:
mv /media/UUID#/usr /media/UUID#/usr1
then rename usr1 to usr
Not to forget to make change to fstab.

Last edited by EDDY1; 02-16-2015 at 03:28 PM.
 
Old 02-17-2015, 05:18 AM   #9
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 863

Original Poster
Rep: Reputation: 45
It seems that there are known issues with having usr in an "unusual" location.

https://wiki.debian.org/ReleaseGoals...itramfshttp://

I have examined my initrd file with lsinitramfs and usr is not mentioned at all.

From the above-referenced link I cannot tell if there is, in fact a problem.

One possible solution would be to boot with the new usr, then update-initramfs. This might then include the info for fsck to find usr during the boot process.

I don't want to destroy my setup so I am considering:

1. Backup the initrd file.
2. Run update-initramfs
3. reboot.
4. If this does not help, restore the initrd file.

Does anybody think this is the way to go?
 
Old 02-17-2015, 10:07 AM   #10
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by EDDY1 View Post
cp command won't work. You'll have to use the mv command.
Since you used the cp command your /usr should still be intact on sda6.
Check sda6 to confirm.
If it's ok then you'll have to removed everything that is in sdb8.
The way I did it was just like what you're attempting, but had to do it from live-cd, because after move was made I couldn't complete because all of the tools that are necessary are in /usr.


from live-cd I used

then rename usr1 to usr
Not to forget to make change to fstab.
Don't use move 'mv' command. Otherwise you loose original copy.
I should have added remove everything from rm -fr /usr1/* and then try cp.
 
Old 02-17-2015, 10:20 AM   #11
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by davcefai View Post
It seems that there are known issues with having usr in an "unusual" location.
I have had problems with systed and mounting partitions. systemd tries to do as much as possible in parallel. As a result bugs in systemd are often intermittent depending on the timing of events happening asynchronously. If you have changed a UUID on a partition check to make sure that fstab reflects the change. Also when systemd gets confused it will go into an arbitrary 1 minute 30 second wait in the hopes that things will straighten themselves out while it counts down the wait.

I also encountered intermittent systemd problems when I switch /usr to a new partition on Debian jessie. I just switched to using Debian wheezy until systemd patched that bug.

--------------------
Steve Stites
 
Old 02-17-2015, 01:49 PM   #12
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
With the mv command you don't lose anything, it just moves /usr & renames it. You could always move it back to the original partition.
If you wanted to you could use gparted to copy the actual data from 1 partition to another.
 
Old 02-17-2015, 06:02 PM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
That presumes everything works. A half-/usr will not be pretty to fix.
Copy means you always have a backup. Deleting the original source later to reclaim the space is much easier than attempting to re-build it. Especially system critical data.
 
Old 02-17-2015, 09:31 PM   #14
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
There's always gparted & clonezilla
 
Old 02-18-2015, 12:38 AM   #15
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
They are. But we can proceed with starting steps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a folder, versus moving its contents (within the same partition) the dsc General 7 06-29-2012 04:46 AM
,dmrc problem after moving /home partition to NTFS partition yeehung Linux - Newbie 1 11-14-2007 06:17 AM
Problem moving /var to separate partition a550ee Linux - Newbie 6 10-02-2007 03:09 PM
Access Denied Problem : Moving A File To usr/lib Help Please DozenEggs Linux - Newbie 5 08-22-2004 06:59 PM
Moving the /usr partition ferrantepunto Linux - General 4 01-08-2003 04:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration