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-02-2017, 01:56 PM   #1
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Rep: Reputation: 20
editing /etc/fstab


I want to play with lfs. I have a ext4 partition that is empty. I don't want to change fstab until I know exactly what to do. As I've mentioned before I'm just getting back to linux and don't remember how. I know lfs is ambitious but I;d like to jump in and get my feet wet. I've succeeded once before.

# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=f3a3b058-e5a4-49fb-8a04-f7c190e7bec8 / ext4 defaults 0 1
# /home was on /dev/sda3 during installation
UUID=8b050d2d-ddf2-498e-b5a4-be7bc616b1d1 /home ext4 defaults 0 2
# swap was on /dev/sda4 during installation
UUID=54ee6d31-6f6e-413d-b4e5-ab82c322d522 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
 
Old 02-03-2017, 12:16 AM   #2
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
You'll need to make a mount point for the partition with command: sudo mkdir /mnt/lfs (I used lfs as a name, change to what you like, the /mnt directory is a good place for mounting partitions.
Run the command sudo fdisk -l to figure out the device name of the partition, then run command: sudo blkid to find the UUID of the partition. Using the "example" blkid command output below, you then add a line in /etc/fstab with same options, dump and pass entries as /, using the new directory created earlier as the mount point, a sample fstab line in second code below.

Example blkid command output
Code:
/dev/sda1: UUID="4097bf06-3fae-4f3f-b024-b4b7621ae0c9" TYPE="ext4" PTTYPE="dos" PARTUUID="eb49b0ef-01"
Example line added to fstab file
Code:
UUID=4097bf06-3fae-4f3f-b024-b4b7621ae0c9  /mnt/lfs  ext4   defaults  0  1
Although I am not sure if the old method is still required, which is to hit the Tab key after each entry rather than a space, or lining it up with other entries, I use the Tab key method, so at the end of the UUID number, hit the Tab key then add the /mnt/lfs, then hit the Tab key again, etc.

Last edited by Brains; 02-03-2017 at 12:24 AM.
 
Old 02-03-2017, 02:10 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,646
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
You don't have to use UUIDs in fstab just because the existing entries use them. Traditional device names like /dev/sda2 are quite acceptable.

A tip for editing system config files: first create a backup with a ".orig" suffix.
Code:
sudo cp /etc/fstab /etc/fstab.orig
That way, if your edit causes any trouble, you can always copy back your backup file. Also you can see at a glance any time which config files you've modified.

Last edited by hazel; 02-03-2017 at 02:12 AM.
 
2 members found this post helpful.
Old 02-03-2017, 02:59 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,334
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
Quote:
Originally Posted by hazel View Post
A tip for editing system config files: first create a backup with a ".orig" suffix.
Code:
sudo cp /etc/fstab /etc/fstab.orig
That way, if your edit causes any trouble, you can always copy back your backup file. Also you can see at a glance any time which config files you've modified.
A thousand times this! It is so much easier to copy back the last known working version of fstab than it is to try to edit it in place on a borked system. I also like to include the -p option so that the date and time of the original is preserved.
 
1 members found this post helpful.
Old 02-03-2017, 05:34 AM   #5
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,144
Blog Entries: 21

Rep: Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482
May help or not.

http://www.howtogeek.com/howto/38125...-does-it-work/
 
Old 02-03-2017, 07:33 AM   #6
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Original Poster
Rep: Reputation: 20
This is what I got

UUID=PARTUUID=e55dc00204 /mnt/lfs ext4 defaults 0 1

lfs says it can't find sda2
 
Old 02-03-2017, 08:23 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
basic rule of thumb that goes across the platform

Code:
source -> detestation
 
Old 02-03-2017, 08:41 AM   #8
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Original Poster
Rep: Reputation: 20
I' sorry. I don't understand. I'm so rusty.
 
Old 02-03-2017, 08:48 AM   #9
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Quote:
Originally Posted by hazel View Post
You don't have to use UUIDs in fstab just because the existing entries use them. Traditional device names like /dev/sda2 are quite acceptable.

A tip for editing system config files: first create a backup with a ".orig" suffix.
Code:
sudo cp /etc/fstab /etc/fstab.orig
That way, if your edit causes any trouble, you can always copy back your backup file. Also you can see at a glance any time which config files you've modified.
Agreed, or if you think you'll be doing it often, for small files it doesn't hurt to keep backups over time, just so that if you need to go back more than one change (or set of changes):

Code:
cp -p /etc/fstab{,.$(date +%H%M-%Y%b%d)}
appends the time and date to the filename. Maybe not necessarily useful for fstab, but other files you'll be changing may be much more useful. Of course you'll want to clean up once in a while, once you're comfortable your changes are good, or you'll fill up etc (or keep the backups in another directory).

Last edited by goumba; 02-03-2017 at 08:49 AM.
 
Old 02-03-2017, 09:42 AM   #10
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Original Poster
Rep: Reputation: 20
I did my backup. I edited fstab as follows:
/dev/sda2 /mnt/lfs ext4 defaults 0 1

I'm getting
wrong fs type, bad option/ bad superblock, on /dev/sda2
 
Old 02-03-2017, 10:17 AM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Mystified View Post
I did my backup. I edited fstab as follows:
/dev/sda2 /mnt/lfs ext4 defaults 0 1

I'm getting
wrong fs type, bad option/ bad superblock, on /dev/sda2
oops that is not nice.

what is on that partition / directory

Code:
blkid
you can look to see what file type it is to be sure it is ext4 .
I'd use gparted to check it for bad blocks create partition table if needed, their are command line options I am sure others know.
 
Old 02-03-2017, 10:30 AM   #12
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Original Poster
Rep: Reputation: 20
I contacted the company after I received my computer and they said all the partitions are ext4
 
Old 02-03-2017, 12:42 PM   #13
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by Mystified View Post
This is what I got

UUID=PARTUUID=e55dc00204 /mnt/lfs ext4 defaults 0 1

lfs says it can't find sda2
This is wrong, look at my examples again, do not put "Partuuid....", put the long number (without the quotes). And using /dev/sdxx instead of the UUID for the file system currently disables pre-mount file system integrity check at boot up on my Debian, there's a reason why the default is to use UUID.
EDIT: And if it still complains after you get the right information in place, hit the Tab key instead of the space key after each section.

Last edited by Brains; 02-03-2017 at 12:56 PM.
 
Old 02-03-2017, 12:58 PM   #14
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,144
Blog Entries: 21

Rep: Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482Reputation: 3482
Just on small ssd laptop right now. my desktop machines have a more elaborate fstab made by me.

Code:
harry@harry-Latitude-XT2:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb1 during installation
UUID=99517a34-0f9f-42d4-af4c-82ae817fb057 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sdb2 during installation
UUID=52dc4336-761c-4976-ac02-0851fa022abc /home           ext4    defaults        0       2
harry@harry-Latitude-XT2:~$
 
Old 02-03-2017, 01:21 PM   #15
Mystified
Member
 
Registered: Mar 2002
Distribution: Debian, Kubuntu
Posts: 311

Original Poster
Rep: Reputation: 20
I fixed that.
thanks for the help. The problem I'm having is that when I try to mount lfs using the instructions it still says it can't find /dev/sda2 And there is no long number. I'm using what the output is.
 
  


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
Editing Fstab linda Linux - General 4 09-03-2006 01:59 PM
editing /etc/fstab Mad Malc Linux - Newbie 6 09-19-2005 01:25 AM
editing the fstab nkoplm Linux - Newbie 1 06-30-2005 02:21 AM
Editing fstab jodef Yoper 4 11-27-2004 09:06 AM
editing the etc/fstab firefightin4fun Linux - Newbie 8 09-20-2003 10:53 PM

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

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