Solved tunefs cannot read superblocks

Hello,

I am new to FreeBSD and I installed it for the first time on a hp elitebook 2570p. There is a ssd in the laptop so I tried to enable trim with this command:
Code:
# tunefs -t enable ada0
But when I try, I get this error:
Code:
tunefs: ada0: could not read superblock to fill out disk
I have used the standard partitioning in the installer with UFS. And are there other settings needed when using a ssd? I ask because I couldn't find specific information about ssd's (or I have overlooked).

Thank you in advance,

Rico
 
Thanks for reply. When I try (I took ada0p2 because that is my root partition and ada0p1 is my boot partition):
# tunefs -t enable ada0p2
Then I get this result:
Code:
tunefs: Can't stat ada0p2: No such file or directory
tunefs: issue TRIM to the disk set
tunefs: ada0p2: failed to write superblock
What am I doing wrong?
 
When in doubt about the correct device identifiers of all the partitions on my system, I ask gpart(8) for its point of view. For example:

# gpart show
Code:
=>        34  5860533101  ada0  GPT  (2.7T)
          34           6        - free -  (3.0K)
          40         128     1  freebsd-boot  (64K)
         168     8388608     2  freebsd-swap  (4.0G)
     8388776  5852144352     3  freebsd-ufs  [bootme]  (2.7T)
  5860533128           7        - free -  (3.5K)

=>        34  3907029101  ada1  GPT  (1.8T)
          34           6        - free -  (3.0K)
          40         128     1  freebsd-boot  (64K)
         168  3907028960     2  freebsd-ufs  [bootme]  (1.8T)
  3907029128           7        - free -  (3.5K)

=>        34  3907029101  ada2  GPT  (1.8T)
          34           6        - free -  (3.0K)
          40         128     1  freebsd-boot  (64K)
         168  3907028960     2  freebsd-ufs  [bootme]  (1.8T)
  3907029128           7        - free -  (3.5K)
In my case the system partition is /dev/ada0p3 (index 3 in the gpart listing).

Another consideration is, that you cannot change file system attributes on a mounted volume. So if you are talking about your system volume, then you need either to boot from it into single-user mode and by this way the root file system would be read-only. Or you need to start your system from a different drive or CD, so you can change the attributes on the non-mounted volume.

PS: tunefs expects the full path of the device identifier, so try your command again using:

# tunefs -t enable /dev/ada0p2
 
When trying to enable the trim option, do I need to be booted in single-user mode then? Or can I do this in the normal mode?
 
I rebooted into the single-user mode. I tried:
# tunefs -t enable /dev/ada0p2
And now the trim was succesfully enabled.

Then I have one question left. Like mentioned the link in this thread:
Please have a look at http://www.wonkity.com/~wblock/docs/html/ssd.html and check the other articles, too.
It is not suggest to have a swap partition, but use a swap file instead. So what I want to do is remove the swap-partition and make a swap file instead. But which tools can I use for doing this?
 
But howcan I remove the swap-partition?
This is possible using gpart(8) with the option delete. The index i is as shown by gpart show. In case of obsigna it would be gpart delete -i 2 /dev/ada0. On your system the index might be different. If you have already some valuable data on the disk it would be safe to have them elsewhere as backup, just in case.
 
Can I do this in normal mode or do I need to this in single-user mode or with the install-disk?
If the swap partition is no more in use it should be possible to do that in normal mode. swapinfo should give you the information. swapoff -a should disable using swap space specified in /etc/fstab.
 
What I did is:
swapoff
then I removed the swap-partition, and then edit /etc/fstab, so that on next boot it would not load the swap partition.
Then I made a swap file discribed in the link.

Thanks for help,

Rico
 
Back
Top