LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation
User Name
Password
Slackware - Installation This forum is for the discussion of installation issues with Slackware.

Notices


Reply
  Search this Thread
Old 01-09-2015, 04:14 PM   #1
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Rep: Reputation: 46
/home is in wrong file system


I am using Salix64 14.1.

I have two HDDs, and 80GB and a 500GB.

My plan was to use the 500GB for swap, and /home.

Unfortunately, I must not have formated the /home, and system must have created a /home directory on the 80GB HDD.

Here is my fstab file.

Code:
/dev/sdb1        swap             swap        defaults         0   0
/dev/sda1        /                ext4        defaults         1   1
/dev/sdb2        /home                        defaults         1   2
Code:
root[etc]# df -m /dev/sda
Filesystem     1M-blocks  Used Available Use% Mounted on
-                   5709     0      5709   0% /dev
root[etc]# df -m /dev/sdb
Filesystem     1M-blocks  Used Available Use% Mounted on
-                   5709     0      5709   0% /dev
root[etc]# df -m /
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/sda1          74998  5669     65498   8% /
root[etc]# df -m /home
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/sda1          74998  5669     65498   8% /
How can I fix this?
 
Old 01-09-2015, 04:48 PM   #2
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
I think I got it.

edit /etc/fstb

Code:
/dev/sdb1        swap             swap        defaults         0   0
/dev/sda1        /                ext4        defaults         1   1
/dev/sdb2        /home            ext4        defaults         1   2

Then

Code:
# mkfs.ext4 /dev/sdb2
# mount -a
 
Old 01-09-2015, 04:51 PM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Please provide output of this command:
Code:
lsblk -o name,fstype,mountpoint,size,model,label,uuid
 
Old 01-09-2015, 05:13 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
[EDIT] Looks like we were typing at the same time. You have already done some of this.

First, note that your "df -m /dev/sda" and "df -m /dev/sdb" are incorrect usage. df works on mounted filesystems, not devices. What you are seeing are the statistics for the devfs virtual filesystem where the inodes for /dev/sda and /dev/sdb reside.

Right now, your /dev/sdb2 is apparently not mounted, at least not on /home. You can confirm this by running "mount | grep sdb2" and observing that there is no output. You need to make sure there is an ext4 filesystem on /dev/sdb2. Run "blkid /dev/sdb2" and see if it finds an ext4 filesystem there. If it does not, you need to run
Code:
mkfs.ext4 /dev/sdb2
Next, your /etc/fstab is wrong. There is a missing field in that /dev/sdb2 line, and an fstab entry cannot have any empty fields. Presumably that line should read:
Code:
/dev/sdb2        /home            ext4        defaults         1   2
Don't do that until there is an ext4 filesystem there or your system will fail to boot. (Right now it just complains about the bad line and does not do the mount.)

Moving the contents of /home is fairly straightforward. As root:
Code:
# mkdir /newhome
# mount /dev/sdb2 /newhome
# cp -a /home/* /newhome
# umount /newhome
# mv /home /oldhome
# mv /newhome /home
Now reboot, and the system should come up with /dev/sdb2 mounted on /home. Once you are satisfied that all is well, you can run (as root) "rm -r /oldhome" to free up that space in the root filesystem.

Last edited by rknichols; 01-09-2015 at 05:14 PM. Reason: Add [EDIT]...
 
Old 01-09-2015, 05:23 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by walterbyrd View Post
I think I got it.

edit /etc/fstb

Code:
/dev/sdb1        swap             swap        defaults         0   0
/dev/sda1        /                ext4        defaults         1   1
/dev/sdb2        /home            ext4        defaults         1   2

Then

Code:
# mkfs.ext4 /dev/sdb2
# mount -a
And now, whatever was in the original /home directory in the root filesystem is still there hidden under the mount point. What you need to do next depends on whether you want to preserve that or not.
Code:
# mkdir /tmp/tmproot
# mount --bind / /tmp/tmproot
Now you can look in /tmp/tmproot/home and see what, if anything, is there. If you want to save it
Code:
# cp -a /tmp/tmproot/home/* /home/
And to clean it out
Code:
# rm -r /tmp/tmproot/home/*
When you are done
Code:
# umount /tmp/tmproot
# rmdir /tmp/tmproot
 
Old 01-09-2015, 06:22 PM   #6
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
> And now, whatever was in the original /home directory in the root filesystem is still there hidden under the mount point.

Yes, it sure was. And that caused me some trouble. I was not able to log in as anybody.

I rebooted with the startup CD, then chrooted over and changed my /etc/fstab file so the /home file system would not mount, then rebooted again.

I created a temporary mount point called /home2, and mounted /dev/sdb2 on home2. But I cannot copy anything to /home2. Even when logged in as root.

I opened a terminal, su-ed to root, and I tried to copy the files from /home to /home2 but that is not working. I tried cp -a and cp -R ; but I keep getting:

cp: cannot create directory ‘./walter’: Read-only file system

Code:
# ls -ld home2
drwxr-xr-x 5 root root 4096 Jan  9 16:53 home2
Since I am logged in as root, it seems like I should be able to write to it, but I cannot.
 
Old 01-09-2015, 06:57 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
I'm not sure how you got to where you are with /home2 mounted read-only. With /etc/fstab changed so that no mount occurs on /home, boot your system normally, then do the steps I laid out at the end of #4, changing "newhome" to the "home2" you've already created:
Code:
# mount /dev/sdb2 /home2
# cp -a /home/* /home2
# umount /home2
# mv /home /oldhome
# mv /home2 /home
Then change /etc/fstab so that /dev/sdb2 does get mounted on /home and reboot.

Clean up by "rm -r /oldhome" once you're sure that all is well.

Last edited by rknichols; 01-09-2015 at 07:26 PM. Reason: Oops, left out the "mount" command
 
Old 01-10-2015, 11:36 AM   #8
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
For whatever reason, mounted the file system rw is turning out to be difficult. Also, I cannot fine a /dev/sdb2 in my directory.

Code:
# mount -t ext4 -o remount,rw /dev/sdb2 /home2
mount: /home2 not mounted or bad option

# ls -ld /dev/sd*
brw-rw---- 1 root disk    8,  0 Jan 10 09:55 /dev/sda
brw-rw---- 1 root disk    8,  1 Jan 10 09:55 /dev/sda1
brw-rw---- 1 root plugdev 8, 32 Jan 10 09:55 /dev/sdc
brw-rw---- 1 root plugdev 8, 48 Jan 10 09:55 /dev/sdd
brw-rw---- 1 root plugdev 8, 64 Jan 10 09:55 /dev/sde
brw-rw---- 1 root plugdev 8, 80 Jan 10 09:55 /dev/sdf
I am not sure what is going on.
 
Old 01-10-2015, 11:41 AM   #9
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Let me repeat that providing output of following command could help us to help you:
Code:
lsblk -o name,fstype,mountpoint,size,model,label,uuid
PS: lsblk lists information about all or the specified block devices. The lsblk command reads the sysfs filesystem to gather information. Thus it doesn't need that the device be properly created in the /dev tree to operate.

Last edited by Didier Spaier; 01-10-2015 at 11:48 AM. Reason: PS added.
 
Old 01-10-2015, 01:31 PM   #10
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
Oddly, the system seems to boot with /dev/sdb then renames it /dev/sdg.

Code:
NAME   FSTYPE MOUNTPOINT   SIZE MODEL    LABEL UUID
sda                       74.5G WDC WD80       
└─sda1 ext4   /           74.5G                c7a0fd20-08c6-494a-bafe-3bd05488b1ac
sdg                      465.8G WDC WD50       
├─sdg1 swap                4.7G                433a2334-c39b-4329-b701-f1de006e8b8f
└─sdg2 ext4              461.1G                79800326-a750-44e7-baae-617961a84500
sr0                       1024M DVD RW A       
sr1                       1024M DVD_RW N
 
Old 01-10-2015, 01:55 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Device names are not going to be consistent. They can change according to what other hardware is plugged in, and occasionally from the phase of the moon or conjunctions of Mars with Jupiter. (OK, it's really the timing of multiple simultaneous threads discovering the hardware.)

In /etc/fstab, make the line read
Code:
UUID=79800326-a750-44e7-baae-617961a84500   /home            ext4        defaults         1   2
A more readable alternative would be to give the filesystem a label by running
Code:
tune2fs -L home /dev/sdX2
(replacing "X" with the letter the drive has at the moment). Then your fstab line could be
Code:
LABEL=home   /home            ext4        defaults         1   2
That label doesn't need to be "home" -- any label will do as long as it is unique.
 
Old 01-10-2015, 02:48 PM   #12
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
Tried this first

Code:
LABEL=home   /home            ext4        defaults         1   2
It worked for a while, then it stopped working, I was getting input/output errors.

Tried this:

Code:
UUID=79800326-a750-44e7-baae-617961a84500   /home            ext4        defaults         1   2
But when I did a mount -a, I got the message:


Code:
mount: special device UID=79800326-a750-44e7-baae-617961a84500 does not exist
But I tried this:

Code:
# lsblk -o name,fstype,mountpoint,size,model,label,uuid
NAME   FSTYPE MOUNTPOINT   SIZE MODEL    LABEL UUID
sda                       74.5G WDC WD80       
└─sda1 ext4   /           74.5G                c7a0fd20-08c6-494a-bafe-3bd05488b1ac
sdg                      465.8G WDC WD50       
├─sdg1 swap                4.7G                433a2334-c39b-4329-b701-f1de006e8b8f
└─sdg2 ext4              461.1G                79800326-a750-44e7-baae-617961a84500
sr0                       1024M DVD RW A       
sr1                       1024M DVD_RW N
Bad disk? It was working fine when I was running CentOS.
 
Old 01-10-2015, 03:00 PM   #13
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Quote:
Originally Posted by walterbyrd View Post
Bad disk? It was working fine when I was running CentOS.
You can check with e2fsck.
 
Old 01-10-2015, 03:11 PM   #14
walterbyrd
Member
 
Registered: Apr 2004
Posts: 734

Original Poster
Rep: Reputation: 46
This is supposed to be ext4 file system, not an ext2 system. I am not sure if that matters.

Code:
# e2fsck /dev/sdg
e2fsck 1.42.8 (20-Jun-2013)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sdg

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 
Old 01-10-2015, 03:26 PM   #15
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Quote:
Originally Posted by walterbyrd View Post
This is supposed to be ext4 file system, not an ext2 system. I am not sure if that matters.
That doesn't matter, despite its name e2fsck is intended for all ext file systems. Read "man e2fsck" to know all options, but i'm afraid that you drive needs to be replaced.

EDIT. Hasty conclusion, your command was wrong, see post #16

Last edited by Didier Spaier; 01-10-2015 at 03:40 PM.
 
  


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
[SOLVED] upgrade issue: my fstab file is wrong, and I can't get my system to read the cdrom mark_alfred Debian 4 03-06-2011 06:26 PM
8.10 Kubuntu install gone wrong, file system read-only? Peripheral Vision Linux - Laptop and Netbook 2 11-04-2008 06:52 PM
Best file system for home server?? mg92865 Linux - Newbie 4 05-29-2008 11:15 PM
File system points to MySQL db's in wrong cPanel nogerorob Linux - Software 0 04-18-2006 09:24 PM
File system guru - please help!! weird /home danimalz Linux - General 9 11-11-2005 12:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation

All times are GMT -5. The time now is 05:46 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