Can’t use partition

Coucou

New Member
Joined
Jan 22, 2020
Messages
6
Reaction score
1
Credits
0
Hi
I installed Ubuntu server 18.04 on 500GB hdd.
5325


There are 3 partitions on this disk. Seems like I’m on sda2 right now, where OS is installed. I have no idea how to get to sda3 to use all that left storage.

5326

$ df -h shows only sda2 as well.

5327



I tried
$ sudo mount /dev/sda3 /hdd
And it returns
mount: /hdd: unknown filesystem type ‘LVM2_member’.

helps would be nice.
thanks in advance.
 
Last edited:


Hey there @Coucou - welcome to the forum.

You do have that 464 gb hda3 there, but Linux doesn't know how to mount it currently because there's no filesystem set up on it yet.

You first want to use a mkfs command to create the filesystem, like the ext4 filesystem with mkfs.ext4 /dev/sda3 as root or w/ sudo.

Once that's done, you can mount it.

Next, you can mount it w/ the mount command you typed earlier.

Further, you can add it into the /etc/fstab so it's mounted automatically each boot.

I'd normally mount a large partition like this to /home .. easiest to set up while you're installing, but if you move the /home directory to /home.bk, then mount /dev/hda3 at /home.. you can then copy (cp -a /home.bk/* /home/) and then see if everything lines up.

You will want to make sure it's in /etc/fstab before you reboot next though - otherwise you won't be able to find your user's home directory.
 
By the way.. if you're looking for an /etc/fstab line to add, this could work for you. This is if you choose to make it /home. If you mount it at /hdd, make the empty /hdd directory first, then mount it.. and change /home in this command to /hdd

Code:
/dev/sda3              /home          ext4      defaults              1      1
 
Hey there @Coucou - welcome to the forum.

You do have that 464 gb hda3 there, but Linux doesn't know how to mount it currently because there's no filesystem set up on it yet.

You first want to use a mkfs command to create the filesystem, like the ext4 filesystem with mkfs.ext4 /dev/sda3 as root or w/ sudo.

Once that's done, you can mount it.

Next, you can mount it w/ the mount command you typed earlier.

Further, you can add it into the /etc/fstab so it's mounted automatically each boot.

I'd normally mount a large partition like this to /home .. easiest to set up while you're installing, but if you move the /home directory to /home.bk, then mount /dev/hda3 at /home.. you can then copy (cp -a /home.bk/* /home/) and then see if everything lines up.

You will want to make sure it's in /etc/fstab before you reboot next though - otherwise you won't be able to find your user's home directory.

Thanks for kind help.

I tried $ mkfs.ext4 /dev/sda3, but it says
/dev/sda3 is apparently in use by the system; will not make a filesystem here!


I read it's because sda has swap partition. So I deleted a line about swap partition on /etc/fstab. After rebooting, it didn't help at all. Still same thing happens.
 
If it's in use by the system, it usually is because it's mounted somewhere.. but you don't see it anywhere in `df -h` or in the `mount` command as root?

No.. can't find it anywhere

Code:
root@my_server:/home/my_nas# df -h


Filesystem                         Size  Used Avail Use% Mounted on


udev                               933M     0  933M   0% /dev


tmpfs                              193M  2.6M  191M   2% /run


/dev/mapper/ubuntu--vg-ubuntu--lv  3.9G  2.9G  849M  78% /


tmpfs                              964M     0  964M   0% /dev/shm


tmpfs                              5.0M  4.0K  5.0M   1% /run/lock


tmpfs                              964M     0  964M   0% /sys/fs/cgroup


/dev/loop0                          89M   89M     0 100% /snap/core/7270


/dev/loop1                          90M   90M     0 100% /snap/core/8268


/dev/sda2                          976M  145M  765M  16% /boot


tmpfs                              193M     0  193M   0% /run/user/1000


I tried dmsetup remove_all as well. Still it doesn't work.
 
Well... I think I find out the problem.

I thought I installed OS on sda2, but it seems it's on sda3 as you can see from the last photo I attached.

That's why I can't format sda3 I guess.
 
Oh - yep.. i totally missed that in your photo.. It looks like it's using lvm - which you should be able to resize since it's saying it's only using 4gb of the space for the OS, then 2G for swap.
 
Thanks haha..

Well.. I intend to use it as NAS. Just for storage.
So I don't need lots of space on the partition where OS installed.

I just want to seperate extra storage from sda3.
Now using command $ parted /dev/sda or fdisk, I'm trying to resize it.

Am I doing rightly? or should I reinstall Ubuntu to resize it?
 
Well, all of sda3 is part of that lvm volume - you may need to do some vgdisplay, lvdisplay, etc.. to create a new space in the volume group that holds your hda3.

It looks like when things were being set up, it kinda said "Hey, i'll create this 400gb volume group, then use 4gb for / and 2gb for swap.. i'll hold on to this extra 394gb in case you need more volumes!"
 
Finally, I made it :)

Code:
$ df -h

Filesystem                         Size  Used Avail Use% Mounted on
udev                               933M     0  933M   0% /dev
tmpfs                              193M  2.6M  191M   2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  3.9G  2.9G  851M  78% /
tmpfs                              964M     0  964M   0% /dev/shm
tmpfs                              5.0M  4.0K  5.0M   1% /run/lock
tmpfs                              964M     0  964M   0% /sys/fs/cgroup
/dev/loop0                          89M   89M     0 100% /snap/core/7270
/dev/loop1                          90M   90M     0 100% /snap/core/8268
/dev/sda2                          976M  145M  765M  16% /boot
tmpfs                              193M     0  193M   0% /run/user/1000
/dev/mapper/ubuntu--vg-hdd         451G   73M  428G   1% /home/roen_nas/NAS_HDD


Thanks again for your advice !


What I've done :
1. $ vgdisplay to find out VG Name. (which was ubuntu-vg)
2. created a new logical volume which contains every storage left.
$ lvcreate -n hdd -l 100%FREE ubuntu-vg
3. format 'hdd' which I just created
$ mkfs.ext4 /dev/ubuntu-vg/hdd
4. and finally mount it!
$ mount -t ext4 /dev/ubuntu-vg/hdd PATH
 
Nice! Also, now you've learned a little more about lvm!

Edit: Don't forget to add it to your /etc/fstab so it's there when you boot.. you can use the line i posted earlier, and replace /dev/sda3 with the /dev/mapper/ubuntu--vg-hdd path. There should be a similar one for the / line.
 
Finally, I made it :)

Code:
$ df -h

Filesystem                         Size  Used Avail Use% Mounted on
udev                               933M     0  933M   0% /dev
tmpfs                              193M  2.6M  191M   2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  3.9G  2.9G  851M  78% /
tmpfs                              964M     0  964M   0% /dev/shm
tmpfs                              5.0M  4.0K  5.0M   1% /run/lock
tmpfs                              964M     0  964M   0% /sys/fs/cgroup
/dev/loop0                          89M   89M     0 100% /snap/core/7270
/dev/loop1                          90M   90M     0 100% /snap/core/8268
/dev/sda2                          976M  145M  765M  16% /boot
tmpfs                              193M     0  193M   0% /run/user/1000
/dev/mapper/ubuntu--vg-hdd         451G   73M  428G   1% /home/roen_nas/NAS_HDD


Thanks again for your advice !


What I've done :
1. $ vgdisplay to find out VG Name. (which was ubuntu-vg)
2. created a new logical volume which contains every storage left.
$ lvcreate -n hdd -l 100%FREE ubuntu-vg
3. format 'hdd' which I just created
$ mkfs.ext4 /dev/ubuntu-vg/hdd
4. and finally mount it!
$ mount -t ext4 /dev/ubuntu-vg/hdd PATH
Well done ;-)
 

Members online


Latest posts

Top